Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
Failing test for npgettext with msgcntxt. Refs ruby-i18n#116.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikos Dimitrakopoulos committed Nov 7, 2011
1 parent da09d52 commit e590b8c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/gettext/backend_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ def test_looks_up_a_namespaced_translation
I18n.locale = :de
assert_equal 'Räderzahl', sgettext('Car|Wheels count')
assert_equal 'Räderzahl', pgettext('Car', 'Wheels count')
assert_equal 'Räderzahl!', pgettext('New car', 'Wheels count')
end

def test_uses_namespaced_default_translation
assert_equal 'Wheels count', sgettext('Car|Wheels count')
assert_equal 'Wheels count', pgettext('Car', 'Wheels count')
assert_equal 'Wheels count', pgettext('New car', 'Wheels count')
end

def test_pluralizes_entry
Expand All @@ -67,13 +69,17 @@ def test_pluralizes_namespaced_entry
assert_equal 'Räder', nsgettext('Car|wheel', 'wheels', 2)
assert_equal 'Rad', npgettext('Car', 'wheel', 'wheels', 1)
assert_equal 'Räder', npgettext('Car', 'wheel', 'wheels', 2)
assert_equal 'Rad!', npgettext('New car', 'wheel', 'wheels', 1)
assert_equal 'Räder!', npgettext('New car', 'wheel', 'wheels', 2)
end

def test_pluralizes_namespaced_default_entry
assert_equal 'wheel', nsgettext('Car|wheel', 'wheels', 1)
assert_equal 'wheels', nsgettext('Car|wheel', 'wheels', 2)
assert_equal 'wheel', npgettext('Car', 'wheel', 'wheels', 1)
assert_equal 'wheels', npgettext('Car', 'wheel', 'wheels', 2)
assert_equal 'wheel', npgettext('New car', 'wheel', 'wheels', 1)
assert_equal 'wheels', npgettext('New car', 'wheel', 'wheels', 2)
end

def test_pluralizes_namespaced_entry_with_alternative_syntax
Expand All @@ -82,6 +88,8 @@ def test_pluralizes_namespaced_entry_with_alternative_syntax
assert_equal 'Räder', nsgettext(['Car|wheel', 'wheels'], 2)
assert_equal 'Rad', npgettext('Car', ['wheel', 'wheels'], 1)
assert_equal 'Räder', npgettext('Car', ['wheel', 'wheels'], 2)
assert_equal 'Rad!', npgettext('New car', ['wheel', 'wheels'], 1)
assert_equal 'Räder!', npgettext('New car', ['wheel', 'wheels'], 2)
end

def test_ngettextpluralizes_entry_with_dots
Expand Down
10 changes: 10 additions & 0 deletions test/test_data/locales/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ msgstr "Modell"
msgid "Car|Wheels count"
msgstr "Räderzahl"

msgctxt "New car"
msgid "Wheels count"
msgstr "Räderzahl!"

#: app/views/cars/show.html.erb:7
msgid "Created"
msgstr "Erstellt"
Expand All @@ -66,6 +70,12 @@ msgid_plural "Car|wheels"
msgstr[0] "Rad"
msgstr[1] "Räder"

msgctxt "New car"
msgid "wheel"
msgid_plural "wheels"
msgstr[0] "Rad!"
msgstr[1] "Räder!"

msgid "On %{count} wheel."
msgid_plural "On %{count} wheels."
msgstr[0] "Auf %{count} Achse."
Expand Down

0 comments on commit e590b8c

Please sign in to comment.