function l10n_update_get_language_names in Localization update 6
Same name and namespace in other branches
- 7 l10n_update.inc \l10n_update_get_language_names()
Get names for the language list from locale system.
Parameters
$string_list: Comma separated list of language codes. Language codes must exist in languages from _locale_get_predefined_list().
Return value
array Array of language names keyed by language code.
File
- ./
l10n_update.inc, line 143
Code
function l10n_update_get_language_names($string_list) {
$t = get_t();
$language_codes = array_map('trim', explode(',', $string_list));
$languages = _locale_get_predefined_list();
$result = array();
foreach ($language_codes as $lang) {
if (array_key_exists($lang, $languages)) {
// Try to use verbose locale name
$name = $lang;
$name = $languages[$name][0] . (isset($languages[$name][1]) ? ' ' . $t('(@language)', array(
'@language' => $languages[$name][1],
)) : '');
$result[$lang] = $name;
}
}
return $result;
}