function tmgmt_language_combination_languages_predefined_list in Translation Management Tool 7
Same name and namespace in other branches
- 8 translators/tmgmt_local/skills/tmgmt_language_combination.module \tmgmt_language_combination_languages_predefined_list()
Prepares a language code list for a select form item with all languages.
2 calls to tmgmt_language_combination_languages_predefined_list()
- tmgmt_language_combination_field_widget_form in translators/
tmgmt_local/ skills/ tmgmt_language_combination.module - Implements hook_field_widget_form().
- tmgmt_language_combination_language_label in translators/
tmgmt_local/ skills/ tmgmt_language_combination.module - Returns the label of a language.
File
- translators/
tmgmt_local/ skills/ tmgmt_language_combination.module, line 257
Code
function tmgmt_language_combination_languages_predefined_list() {
$predefined =& drupal_static(__FUNCTION__);
if (!isset($predefined)) {
include_once DRUPAL_ROOT . '/includes/iso.inc';
$predefined = _locale_get_predefined_list();
foreach ($predefined as $key => $value) {
// Include native name in output, if possible
if (count($value) > 1) {
$tname = t($value[0]);
$predefined[$key] = $tname == $value[1] ? $tname : "{$tname} ({$value[1]})";
}
else {
$predefined[$key] = t($value[0]);
}
}
// Add custom languages that are not part of the iso.inc definition.
$installed_languages = language_list();
foreach ($installed_languages as $lang => $info) {
if (!isset($predefined[$lang])) {
$predefined[$lang] = $info->name;
}
}
asort($predefined);
}
return $predefined;
}