From 4c4c9096c4e3653ddd44aa299d34367e243dd257 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Sat, 7 Dec 2013 11:38:01 +0100 Subject: [PATCH 1/2] fix plural translation - fixes #6226 --- core/js/js.js | 2 +- lib/private/l10n.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index f5991cfc9dd..d9b3b54e0a1 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -115,7 +115,7 @@ t.cache = {}; */ function n(app, text_singular, text_plural, count, vars) { initL10N(app); - var identifier = '_' + text_singular + '__' + text_plural + '_'; + var identifier = '_' + text_singular + '_::_' + text_plural + '_'; if( typeof( t.cache[app][identifier] ) !== 'undefined' ){ var translation = t.cache[app][identifier]; if ($.isArray(translation)) { diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 2d440850459..98665c84c55 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -262,7 +262,7 @@ class OC_L10N implements \OCP\IL10N { */ public function n($text_singular, $text_plural, $count, $parameters = array()) { $this->init(); - $identifier = "_${text_singular}__${text_plural}_"; + $identifier = "_${text_singular}_::_${text_plural}_"; if( array_key_exists($identifier, $this->translations)) { return new OC_L10N_String( $this, $identifier, $parameters, $count ); } From 67957294c2ae7232f39690d25efd19cefa9d0ef4 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Sat, 7 Dec 2013 13:29:14 +0100 Subject: [PATCH 2/2] fix wrong test data in l10n --- tests/data/l10n/cs.php | 2 +- tests/data/l10n/de.php | 2 +- tests/data/l10n/ru.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/data/l10n/cs.php b/tests/data/l10n/cs.php index 1c5907bc148..de106ede026 100644 --- a/tests/data/l10n/cs.php +++ b/tests/data/l10n/cs.php @@ -1,5 +1,5 @@ array("%n okno", "%n okna", "%n oken") + "_%n window_::_%n windows_" => array("%n okno", "%n okna", "%n oken") ); $PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"; diff --git a/tests/data/l10n/de.php b/tests/data/l10n/de.php index 858ec8af49c..93c9ab4209e 100644 --- a/tests/data/l10n/de.php +++ b/tests/data/l10n/de.php @@ -1,5 +1,5 @@ array("%n Datei", "%n Dateien") + "_%n file_::_%n files_" => array("%n Datei", "%n Dateien") ); $PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/tests/data/l10n/ru.php b/tests/data/l10n/ru.php index dd46293db6c..b778e8d79af 100644 --- a/tests/data/l10n/ru.php +++ b/tests/data/l10n/ru.php @@ -1,5 +1,5 @@ array("%n файл", "%n файла", "%n файлов") + "_%n file_::_%n files_" => array("%n файл", "%n файла", "%n файлов") ); $PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";