From 12cb4f014a469948252ec37521ef5c2373ed07c1 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 6 Jun 2014 10:58:05 +0000 Subject: [PATCH] Remove "names" locale --- .../Controller/CannedMessageController.php | 3 +- src/mibew/libs/common/locale.php | 60 ++++++++++++++++++- src/mibew/locales/names/properties | 43 ------------- 3 files changed, 61 insertions(+), 45 deletions(-) delete mode 100644 src/mibew/locales/names/properties diff --git a/src/mibew/libs/classes/Mibew/Controller/CannedMessageController.php b/src/mibew/libs/classes/Mibew/Controller/CannedMessageController.php index 9395d3a9..1e2e5e10 100644 --- a/src/mibew/libs/classes/Mibew/Controller/CannedMessageController.php +++ b/src/mibew/libs/classes/Mibew/Controller/CannedMessageController.php @@ -42,11 +42,12 @@ class CannedMessageController extends AbstractController // Build list of available locales $all_locales = get_available_locales(); + $locale_names = get_locale_names(); $locales_with_label = array(); foreach ($all_locales as $id) { $locales_with_label[] = array( 'id' => $id, - 'name' => getlocal($id, null, 'names') + 'name' => (isset($locale_names[$id]) ? $locale_names[$id] : $id) ); } $page['locales'] = $locales_with_label; diff --git a/src/mibew/libs/common/locale.php b/src/mibew/libs/common/locale.php index 25afa292..e7314a94 100644 --- a/src/mibew/libs/common/locale.php +++ b/src/mibew/libs/common/locale.php @@ -135,18 +135,76 @@ function get_locale() function get_locale_links() { + // Get list of available locales $locale_links = array(); $all_locales = get_available_locales(); if (count($all_locales) < 2) { return null; } + + // Attache locale names + $locale_names = get_locale_names(); foreach ($all_locales as $k) { - $locale_links[$k] = getlocal($k, null, 'names'); + $locale_links[$k] = isset($locale_names[$k]) ? $locale_names[$k] : $k; } return $locale_links; } +/** + * Returns list of human readable locale names. + * + * @return array + */ +function get_locale_names() +{ + return array( + 'ar' => 'العربية', + 'be' => 'Беларуская', + 'bg' => 'Български', + 'ca' => 'Català', + 'cs' => 'Česky', + 'da' => 'Dansk', + 'de' => 'Deutsch', + 'el' => 'Ελληνικά', + 'en' => 'English', + 'es' => 'Español', + 'et' => 'Eesti', + 'fa' => 'فارسی', + 'fi' => 'Suomi', + 'fr' => 'Français', + 'he' => 'עברית', + 'hr' => 'Hrvatski', + 'hu' => 'Magyar', + 'id' => 'Bahasa Indonesia', + 'it' => 'Italiano', + 'jp' => '日本語', + 'ka' => 'ქართული', + 'kk' => 'Қазақша', + 'ko' => '한국어', + 'ky' => 'Кыргызча', + 'lt' => 'Lietuvių', + 'lv' => 'Latviešu', + 'nl' => 'Nederlands', + 'nn' => 'Norsk nynorsk', + 'no' => 'Norsk bokmål', + 'pl' => 'Polski', + 'pt-pt' => 'Português', + 'pt-br' => 'Português Brasil', + 'ro' => 'Română', + 'ru' => 'Русский', + 'sk' => 'Slovenčina', + 'sl' => 'Slovenščina', + 'sr' => 'Српски', + 'sv' => 'Svenska', + 'th' => 'ไทย', + 'tr' => 'Türkçe', + 'ua' => 'Українська', + 'zh-cn' => '中文', + 'zh-tw' => '文言', + ); +} + /** * Load localized messages id some service locale info. * diff --git a/src/mibew/locales/names/properties b/src/mibew/locales/names/properties deleted file mode 100644 index 2b4e5c64..00000000 --- a/src/mibew/locales/names/properties +++ /dev/null @@ -1,43 +0,0 @@ -ar=العربية -be=Беларуская -bg=Български -ca=Català -cs=Česky -da=Dansk -de=Deutsch -el=Ελληνικά -en=English -es=Español -et=Eesti -fa=فارسی -fi=Suomi -fr=Français -he=עברית -hr=Hrvatski -hu=Magyar -id=Bahasa Indonesia -it=Italiano -jp=日本語 -ka=ქართული -kk=Қазақша -ko=한국어 -ky=Кыргызча -lt=Lietuvių -lv=Latviešu -nl=Nederlands -nn=Norsk nynorsk -no=Norsk bokmål -pl=Polski -pt-pt=Português -pt-br=Português Brasil -ro=Română -ru=Русский -sk=Slovenčina -sl=Slovenščina -sr=Српски -sv=Svenska -th=ไทย -tr=Türkçe -ua=Українська -zh-cn=中文 -zh-tw=文言