diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-10-13 17:44:57 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-10-20 15:04:42 +0200 |
commit | c8e8945efbac31605b6cb80723992b8bfdbd259c (patch) | |
tree | 788fc8bf9df146602b8bc0517e0c6106020169f6 /tests | |
parent | 8da6e4b9f09d6d7a03fb602c6d5fe73e87b96a87 (diff) | |
download | nextcloud-server-c8e8945efbac31605b6cb80723992b8bfdbd259c.tar.gz nextcloud-server-c8e8945efbac31605b6cb80723992b8bfdbd259c.zip |
implement localizations based on punic
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/l10n.php | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/tests/lib/l10n.php b/tests/lib/l10n.php index 5ddf2290c35..26ad87b60f6 100644 --- a/tests/lib/l10n.php +++ b/tests/lib/l10n.php @@ -52,17 +52,59 @@ class Test_L10n extends PHPUnit_Framework_TestCase { $this->assertEquals('5 oken', (string)$l->n('%n window', '%n windows', 5)); } + public function localizationDataProvider() { + return array( + // timestamp as string + array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'datetime', '1234567890'), + array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'datetime', '1234567890'), + array('February 13, 2009', 'en', 'date', '1234567890'), + array('13. Februar 2009', 'de', 'date', '1234567890'), + array('11:31:30 PM GMT+0', 'en', 'time', '1234567890'), + array('23:31:30 GMT+0', 'de', 'time', '1234567890'), + + // timestamp as int + array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'datetime', 1234567890), + array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'datetime', 1234567890), + array('February 13, 2009', 'en', 'date', 1234567890), + array('13. Februar 2009', 'de', 'date', 1234567890), + array('11:31:30 PM GMT+0', 'en', 'time', 1234567890), + array('23:31:30 GMT+0', 'de', 'time', 1234567890), + + // DateTime object + array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'datetime', new DateTime('@1234567890')), + array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'datetime', new DateTime('@1234567890')), + array('February 13, 2009', 'en', 'date', new DateTime('@1234567890')), + array('13. Februar 2009', 'de', 'date', new DateTime('@1234567890')), + array('11:31:30 PM GMT+0', 'en', 'time', new DateTime('@1234567890')), + array('23:31:30 GMT+0', 'de', 'time', new DateTime('@1234567890')), + ); + } + /** - * Issue #4360: Do not call strtotime() on numeric strings. + * @dataProvider localizationDataProvider */ - public function testNumericStringToDateTime() { + public function testNumericStringLocalization($expectedDate, $lang, $type, $value) { $l = new OC_L10N('test'); - $this->assertSame('February 13, 2009 23:31', $l->l('datetime', '1234567890')); + $l->forceLanguage($lang); + $this->assertSame($expectedDate, $l->l($type, $value)); + } + + public function firstDayDataProvider() { + return array( + array(1, 'de'), + array(0, 'en'), + ); } - public function testNumericToDateTime() { + /** + * @dataProvider firstDayDataProvider + * @param $expected + * @param $lang + */ + public function testFirstWeekDay($expected, $lang) { $l = new OC_L10N('test'); - $this->assertSame('February 13, 2009 23:31', $l->l('datetime', 1234567890)); + $l->forceLanguage($lang); + $this->assertSame($expected, $l->l('firstday', 'firstday')); } /** |