aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-10-24 13:53:01 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-10-29 10:09:12 +0100
commit2f19de11e4c77b0f9195c3868960d8105541359f (patch)
treece8e3e45d519c392a7582e2fe452402e070301c0 /tests
parentd71cd680dd6133ad254fd296319aeab6deb77686 (diff)
downloadnextcloud-server-2f19de11e4c77b0f9195c3868960d8105541359f.tar.gz
nextcloud-server-2f19de11e4c77b0f9195c3868960d8105541359f.zip
adding console command to generate javascript translation files based on existing php translation files
read server side translations from json files
Diffstat (limited to 'tests')
-rw-r--r--tests/data/l10n/cs.json6
-rw-r--r--tests/data/l10n/cs.php5
-rw-r--r--tests/data/l10n/de.json6
-rw-r--r--tests/data/l10n/de.php5
-rw-r--r--tests/data/l10n/ru.json6
-rw-r--r--tests/data/l10n/ru.php5
-rw-r--r--tests/lib/l10n.php6
7 files changed, 21 insertions, 18 deletions
diff --git a/tests/data/l10n/cs.json b/tests/data/l10n/cs.json
new file mode 100644
index 00000000000..c86f41aa077
--- /dev/null
+++ b/tests/data/l10n/cs.json
@@ -0,0 +1,6 @@
+{
+ "translations" : {
+ "_%n window_::_%n windows_" : ["%n okno", "%n okna", "%n oken"]
+ },
+ "pluralForm" : "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
+}
diff --git a/tests/data/l10n/cs.php b/tests/data/l10n/cs.php
deleted file mode 100644
index de106ede026..00000000000
--- a/tests/data/l10n/cs.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-$TRANSLATIONS = array(
- "_%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.json b/tests/data/l10n/de.json
new file mode 100644
index 00000000000..c2b6f34c081
--- /dev/null
+++ b/tests/data/l10n/de.json
@@ -0,0 +1,6 @@
+{
+ "translations" : {
+ "_%n file_::_%n files_": ["%n Datei", "%n Dateien"]
+ },
+ "pluralForm" : "nplurals=2; plural=(n != 1);"
+}
diff --git a/tests/data/l10n/de.php b/tests/data/l10n/de.php
deleted file mode 100644
index 93c9ab4209e..00000000000
--- a/tests/data/l10n/de.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-$TRANSLATIONS = array(
- "_%n file_::_%n files_" => array("%n Datei", "%n Dateien")
-);
-$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/tests/data/l10n/ru.json b/tests/data/l10n/ru.json
new file mode 100644
index 00000000000..177b14a6b20
--- /dev/null
+++ b/tests/data/l10n/ru.json
@@ -0,0 +1,6 @@
+{
+ "translations" : {
+ "_%n file_::_%n files_" : ["%n файл", "%n файла", "%n файлов"]
+ },
+ "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/data/l10n/ru.php b/tests/data/l10n/ru.php
deleted file mode 100644
index b778e8d79af..00000000000
--- a/tests/data/l10n/ru.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-$TRANSLATIONS = array(
- "_%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);";
diff --git a/tests/lib/l10n.php b/tests/lib/l10n.php
index a97fa22f05c..df86fcfda81 100644
--- a/tests/lib/l10n.php
+++ b/tests/lib/l10n.php
@@ -10,7 +10,7 @@ class Test_L10n extends PHPUnit_Framework_TestCase {
public function testGermanPluralTranslations() {
$l = new OC_L10N('test');
- $transFile = OC::$SERVERROOT.'/tests/data/l10n/de.php';
+ $transFile = OC::$SERVERROOT.'/tests/data/l10n/de.json';
$l->load($transFile);
$this->assertEquals('1 Datei', (string)$l->n('%n file', '%n files', 1));
@@ -19,7 +19,7 @@ class Test_L10n extends PHPUnit_Framework_TestCase {
public function testRussianPluralTranslations() {
$l = new OC_L10N('test');
- $transFile = OC::$SERVERROOT.'/tests/data/l10n/ru.php';
+ $transFile = OC::$SERVERROOT.'/tests/data/l10n/ru.json';
$l->load($transFile);
$this->assertEquals('1 файл', (string)$l->n('%n file', '%n files', 1));
@@ -44,7 +44,7 @@ class Test_L10n extends PHPUnit_Framework_TestCase {
public function testCzechPluralTranslations() {
$l = new OC_L10N('test');
- $transFile = OC::$SERVERROOT.'/tests/data/l10n/cs.php';
+ $transFile = OC::$SERVERROOT.'/tests/data/l10n/cs.json';
$l->load($transFile);
$this->assertEquals('1 okno', (string)$l->n('%n window', '%n windows', 1));