diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 14:21:08 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 14:21:08 +0200 |
commit | c64101ff6e31f5302ea026b61505c877c6f804f0 (patch) | |
tree | 36ee0bdf8710bce7a4830c7e62e38107d8529558 | |
parent | 594a3e4e22223389a306acad4e3921027decad96 (diff) | |
parent | 6b53f7c40e8bbaecfa20a3b19b3164e332903f59 (diff) | |
download | nextcloud-server-c64101ff6e31f5302ea026b61505c877c6f804f0.tar.gz nextcloud-server-c64101ff6e31f5302ea026b61505c877c6f804f0.zip |
Merge pull request #19482 from owncloud/kill-unused-method
[l10n] remove unused static methods
-rw-r--r-- | lib/private/l10n.php | 39 | ||||
-rw-r--r-- | 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 89ce2bc8d72..b3c87292f1d 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -390,29 +390,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 * * @return string language @@ -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 d5f9a5ca3fa..cb2f4179c4d 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')); } |