From 6b53f7c40e8bbaecfa20a3b19b3164e332903f59 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 30 Sep 2015 17:53:15 +0200 Subject: [PATCH] [l10n] remove unused static methods --- lib/private/l10n.php | 39 +++------------------------------------ tests/lib/l10n.php | 6 ++---- 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 89ce2bc8d7..b3c87292f1 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -389,29 +389,6 @@ class OC_L10N implements \OCP\IL10N { } } - /** - * Choose a language - * @param array $text Associative Array with possible strings - * @return String - * - * $text is an array 'de' => 'hallo welt', 'en' => 'hello world', ... - * - * This function is useful to avoid loading thousands of files if only one - * simple string is needed, for example in appinfo.php - */ - public static function selectLanguage($text) { - $lang = self::findLanguage(array_keys($text)); - return $text[$lang]; - } - - /** - * The given language is forced to be used while executing the current request - * @param string $lang - */ - public static function forceLanguage($lang) { - self::$language = $lang; - } - /** * The code (en, de, ...) of the language that is used for this OC_L10N object * @@ -423,17 +400,13 @@ class OC_L10N implements \OCP\IL10N { /** * find the best language - * @param array|string $app details below + * @param string $app * @return string language * - * If $app is an array, ownCloud assumes that these are the available - * languages. Otherwise ownCloud tries to find the files in the l10n - * folder. - * * If nothing works it returns 'en' */ public static function findLanguage($app = null) { - if(!is_array($app) && self::$language != '') { + if(self::$language != '') { return self::$language; } @@ -443,13 +416,7 @@ class OC_L10N implements \OCP\IL10N { if($userId && $config->getUserValue($userId, 'core', 'lang')) { $lang = $config->getUserValue($userId, 'core', 'lang'); self::$language = $lang; - if(is_array($app)) { - $available = $app; - $lang_exists = array_search($lang, $available) !== false; - } else { - $lang_exists = self::languageExists($app, $lang); - } - if($lang_exists) { + if(self::languageExists($app, $lang)) { return $lang; } } diff --git a/tests/lib/l10n.php b/tests/lib/l10n.php index d5f9a5ca3f..cb2f4179c4 100644 --- a/tests/lib/l10n.php +++ b/tests/lib/l10n.php @@ -92,8 +92,7 @@ class Test_L10n extends \Test\TestCase { * @dataProvider localizationDataProvider */ public function testNumericStringLocalization($expectedDate, $lang, $type, $value) { - $l = new OC_L10N('test'); - $l->forceLanguage($lang); + $l = new OC_L10N('test', $lang); $this->assertSame($expectedDate, $l->l($type, $value)); } @@ -110,8 +109,7 @@ class Test_L10n extends \Test\TestCase { * @param $lang */ public function testFirstWeekDay($expected, $lang) { - $l = new OC_L10N('test'); - $l->forceLanguage($lang); + $l = new OC_L10N('test', $lang); $this->assertSame($expected, $l->l('firstday', 'firstday')); }