Browse Source

Adding a test to show the translation issue of plurals

Florian Krämer 8 years ago
parent
commit
70c978dbac
2 changed files with 33 additions and 0 deletions
  1. 13 0
      tests/TestCase/I18n/I18nTest.php
  2. 20 0
      tests/test_app/TestApp/Locale/de/wa.po

+ 13 - 0
tests/TestCase/I18n/I18nTest.php

@@ -857,4 +857,17 @@ class I18nTest extends TestCase
         $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 - 0
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"