1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* Returns array of language names.
|
5 |
|
|
*
|
6 |
|
|
* This is a one to one copy of locale_language_list because we can't rely on enabled locale module.
|
7 |
|
|
*
|
8 |
|
|
* @param $field
|
9 |
|
|
* 'name' => names in current language, localized
|
10 |
|
|
* 'native' => native names
|
11 |
|
|
* @param $all
|
12 |
|
|
* Boolean to return all languages or only enabled ones
|
13 |
|
|
*
|
14 |
|
|
* @see locale_language_list
|
15 |
|
|
*/
|
16 |
|
|
function ctools_language_list($field = 'name', $all = FALSE) {
|
17 |
|
|
if ($all) {
|
18 |
|
|
$languages = language_list();
|
19 |
|
|
}
|
20 |
|
|
else {
|
21 |
|
|
$languages = language_list('enabled');
|
22 |
|
|
$languages = $languages[1];
|
23 |
|
|
}
|
24 |
|
|
$list = array();
|
25 |
|
|
foreach ($languages as $language) {
|
26 |
|
|
$list[$language->language] = ($field == 'name') ? t($language->name) : $language->$field;
|
27 |
|
|
}
|
28 |
|
|
return $list;
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
/**
|
32 |
|
|
* Returns an array of language names similar to ctools_language_list() except
|
33 |
|
|
* that additional choices have been added for ease of use.
|
34 |
|
|
*/
|
35 |
|
|
|
36 |
|
|
function ctools_language_list_all() {
|
37 |
|
|
$languages = array(
|
38 |
|
|
'***CURRENT_LANGUAGE***' => t("Current user's language"),
|
39 |
|
|
'***DEFAULT_LANGUAGE***' => t("Default site language"),
|
40 |
|
|
LANGUAGE_NONE => t('Language neutral'),
|
41 |
|
|
);
|
42 |
|
|
$languages = array_merge($languages, ctools_language_list());
|
43 |
|
|
return $languages;
|
44 |
|
|
} |