Skip to content

Commit

Permalink
Adding a test to show the translation issue of plurals
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum authored and markstory committed Aug 31, 2017
1 parent 95b0de3 commit 70c978d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/TestCase/I18n/I18nTest.php
Expand Up @@ -857,4 +857,17 @@ public function testEmptyTranslationString()
$result = __('No translation needed');
$this->assertEquals('No translation needed', $result);
}

/**
* Tests that a plurals from a domain get translated correctly
*
* @return void
*/
public function testPluralTranslationsFromDomain()
{
I18n::locale('de');
$this->assertEquals('Standorte', __dn('wa', 'Location', 'Locations', 0));
$this->assertEquals('Standort', __dn('wa', 'Location', 'Locations', 1));
$this->assertEquals('Standorte', __dn('wa', 'Location', 'Locations', 2));
}
}
20 changes: 20 additions & 0 deletions tests/test_app/TestApp/Locale/de/wa.po
@@ -0,0 +1,20 @@
msgid ""
msgstr ""
"Project-Id-Version: VERSION\n"
"POT-Creation-Date: 2017-06-23 08:49+0000\n"
"PO-Revision-Date: 2017-06-23 08:49+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE TEAM <EMAIL@ADDRESS>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgid "Location"
msgid_plural "Locations"
msgstr[0] "Standort"
msgstr[1] "Standorte"

msgid "Locations"
msgstr "Standorte"

0 comments on commit 70c978d

Please sign in to comment.