diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-12-11 11:33:40 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-12-11 12:42:21 +0100 |
commit | cbad5c998b260040523ac8e6a2797591d0086938 (patch) | |
tree | f53b611ef5fad393979b5f3cc1c39eac3cd0e729 /tests | |
parent | b33d8a3d60555de3e6e99a92eed3a303e55a3380 (diff) | |
download | nextcloud-server-cbad5c998b260040523ac8e6a2797591d0086938.tar.gz nextcloud-server-cbad5c998b260040523ac8e6a2797591d0086938.zip |
Correctly fallback to english, if the plural case is not translated
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/l10n/ru.json | 3 | ||||
-rw-r--r-- | tests/lib/l10n.php | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/data/l10n/ru.json b/tests/data/l10n/ru.json index 177b14a6b20..7041205e761 100644 --- a/tests/data/l10n/ru.json +++ b/tests/data/l10n/ru.json @@ -1,6 +1,7 @@ { "translations" : { - "_%n file_::_%n files_" : ["%n файл", "%n файла", "%n файлов"] + "_%n file_::_%n files_" : ["%n файл", "%n файла", "%n файлов"], + "_%n missing plural_::_%n missing plurals_" : ["", "", ""] }, "pluralForm" : "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" } diff --git a/tests/lib/l10n.php b/tests/lib/l10n.php index 68f43b76f51..2235581add8 100644 --- a/tests/lib/l10n.php +++ b/tests/lib/l10n.php @@ -42,6 +42,24 @@ class Test_L10n extends \Test\TestCase { */ } + public function russianMissingPluralTranslationsData() { + return array( + array(1, '1 missing plural'), + array(2, '2 missing plurals'), + array(6, '6 missing plurals'), + ); + } + + /** + * @dataProvider russianMissingPluralTranslationsData + */ + public function testRussianMissingPluralTranslations($count, $expected) { + $l = new OC_L10N('test'); + $l->load(OC::$SERVERROOT.'/tests/data/l10n/ru.json'); + + $this->assertEquals($expected, (string)$l->n('%n missing plural', '%n missing plurals', $count)); + } + public function testCzechPluralTranslations() { $l = new OC_L10N('test'); $transFile = OC::$SERVERROOT.'/tests/data/l10n/cs.json'; |