From 334d5a4546fffcff1e9e64986dd6a71d88429255 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 29 Oct 2016 10:04:15 +0100 Subject: [PATCH] Native language (adjustments after 12036 merge) (#12394) * restore native language * remvoe space * correct * simplify * improve code * ups * native language in unit test too --- libraries/joomla/language/helper.php | 10 +++++----- .../libraries/joomla/language/JLanguageHelperTest.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/joomla/language/helper.php b/libraries/joomla/language/helper.php index b3a3776163732..39995739a9bef 100644 --- a/libraries/joomla/language/helper.php +++ b/libraries/joomla/language/helper.php @@ -55,12 +55,12 @@ public static function createLanguageList($actualLanguage, $basePath = JPATH_BAS { if (!$installed || array_key_exists($lang, $installed_languages)) { - $option = array(); + $option = array( + 'text' => isset($metadata['nativeName']) ? $metadata['nativeName'] : $metadata['name'], + 'value' => $lang, + ); - $option['text'] = $metadata['name']; - $option['value'] = $lang; - - if ($lang == $actualLanguage) + if ($lang === $actualLanguage) { $option['selected'] = 'selected="selected"'; } diff --git a/tests/unit/suites/libraries/joomla/language/JLanguageHelperTest.php b/tests/unit/suites/libraries/joomla/language/JLanguageHelperTest.php index fbf6b844db481..1178d7de927ec 100644 --- a/tests/unit/suites/libraries/joomla/language/JLanguageHelperTest.php +++ b/tests/unit/suites/libraries/joomla/language/JLanguageHelperTest.php @@ -23,7 +23,7 @@ class JLanguageHelperTest extends PHPUnit_Framework_TestCase public function testCreateLanguageList() { $option = array( - 'text' => 'English (en-GB)', + 'text' => 'English (United Kingdom)', 'value' => 'en-GB', 'selected' => 'selected="selected"' );