Commit 87b6e60c9dd9f2dec4ede89e48b182c67409cd6c

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent d084befd

Fix: terminology and ngettext works fine together

(ActionItem1762)
lib/noosfero/core_ext/object.rb
... ... @@ -5,6 +5,6 @@ class Object
5 5 alias :getterm :__
6 6  
7 7 def n__(for_one, for_many, num)
8   - getterm(ngettext(for_one, for_many, num))
  8 + ngettext(getterm(for_one), getterm(for_many), num)
9 9 end
10 10 end
... ...
test/unit/noosfero_test.rb
... ... @@ -56,4 +56,16 @@ class NoosferoTest < Test::Unit::TestCase
56 56 assert_equal 'en', FastGettext.locale
57 57 end
58 58  
  59 + should 'use terminology with ngettext' do
  60 + Noosfero.terminology = UnifreireTerminology.instance
  61 +
  62 + Noosfero.with_locale('en') do
  63 + assert_equal 'One institution', n__('One enterprise', '%{num} enterprises', 1)
  64 + end
  65 +
  66 + Noosfero.with_locale('pt') do
  67 + assert_equal 'Uma instituição', n__('One enterprise', '%{num} enterprises', 1)
  68 + end
  69 + end
  70 +
59 71 end
... ...