mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Remove "get_locale_names" function
This commit is contained in:
parent
2f82594a60
commit
7edc74b253
@ -42,12 +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) {
|
||||
$locale_info = get_locale_info($id);
|
||||
$locales_with_label[] = array(
|
||||
'id' => $id,
|
||||
'name' => (isset($locale_names[$id]) ? $locale_names[$id] : $id)
|
||||
'name' => ($locale_info ? $locale_info['name'] : $id)
|
||||
);
|
||||
}
|
||||
$page['locales'] = $locales_with_label;
|
||||
|
@ -43,14 +43,14 @@ class LocaleController extends AbstractController
|
||||
);
|
||||
|
||||
$fs_locales = discover_locales();
|
||||
$locale_names = get_locale_names();
|
||||
$available_locales = get_available_locales();
|
||||
|
||||
$locales_list = array();
|
||||
foreach ($fs_locales as $locale) {
|
||||
$locale_info = get_locale_info($locale);
|
||||
$locales_list[] = array(
|
||||
'code' => $locale,
|
||||
'name' => (isset($locale_names[$locale]) ? $locale_names[$locale] : $locale),
|
||||
'name' => ($locale_info ? $locale_info['name'] : $locale),
|
||||
'isDisabled' => !in_array($locale, $available_locales),
|
||||
);
|
||||
}
|
||||
|
@ -203,13 +203,11 @@ class TranslationController extends AbstractController
|
||||
*/
|
||||
protected function getLocaleName($locale)
|
||||
{
|
||||
$names = get_locale_names();
|
||||
$locale_info = get_locale_info($locale);
|
||||
|
||||
if (isset($names[$locale])) {
|
||||
return sprintf('%s (%s)', $names[$locale], $locale);
|
||||
}
|
||||
|
||||
return $locale;
|
||||
return $locale_info
|
||||
? sprintf('%s (%s)', $locale_info['name'], $locale)
|
||||
: $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,12 +37,12 @@ class MailTemplateController 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) {
|
||||
$locale_info = get_locale_info($id);
|
||||
$locales_with_label[] = array(
|
||||
'id' => $id,
|
||||
'name' => (isset($locale_names[$id]) ? $locale_names[$id] : $id)
|
||||
'name' => ($locale_info ? $locale_info['name'] : $id)
|
||||
);
|
||||
}
|
||||
$page['locales'] = $locales_with_label;
|
||||
|
@ -178,34 +178,14 @@ function get_locale_links()
|
||||
}
|
||||
|
||||
// Attache locale names
|
||||
$locale_names = get_locale_names();
|
||||
foreach ($all_locales as $k) {
|
||||
$locale_links[$k] = isset($locale_names[$k]) ? $locale_names[$k] : $k;
|
||||
$locale_info = get_locale_info($k);
|
||||
$locale_links[$k] = $locale_info ? $locale_info['name'] : $k;
|
||||
}
|
||||
|
||||
return $locale_links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of human readable locale names.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_locale_names()
|
||||
{
|
||||
static $names = false;
|
||||
|
||||
if ($names === false) {
|
||||
$locales = get_locales();
|
||||
$names = array();
|
||||
foreach ($locales as $code => $info) {
|
||||
$names[$code] = $info['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta data for all known locales.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user