2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Code for displaying language selection
8 if (! defined('PHPMYADMIN')) {
13 * Compares the names of two languages.
14 * Used by uasort in PMA_getLanguageSelectorHtml()
16 * @param array $a The first language being compared
17 * @param array $b The second language being compared
19 * @return int the sorted array
21 function PMA_languageCmp($a, $b)
23 return strcmp($a[1], $b[1]);
27 * Returns HTML code for the language selector
29 * @param boolean $use_fieldset whether to use fieldset for selection
30 * @param boolean $show_doc whether to show documentation links
36 function PMA_getLanguageSelectorHtml($use_fieldset = false, $show_doc = true)
42 // Display language selection only if there
43 // is more than one language to choose from
44 if (count($GLOBALS['available_languages']) > 1) {
45 $retval .= '<form method="get" action="index.php" class="disableAjax">';
47 $_form_params = array(
48 'db' => $GLOBALS['db'],
49 'table' => $GLOBALS['table'],
51 $retval .= PMA_URL_getHiddenInputs($_form_params);
53 // For non-English, display "Language" with emphasis because it's
54 // not a proper word in the current language; we show it to help
55 // people recognize the dialog
56 $language_title = __('Language')
57 . (__('Language') != 'Language' ?
' - <em>Language</em>' : '');
59 $language_title .= PMA_Util
::showDocu('faq', 'faq7-2');
62 $retval .= '<fieldset><legend lang="en" dir="ltr">'
63 . $language_title . '</legend>';
65 $retval .= '<bdo lang="en" dir="ltr"><label for="sel-lang">'
66 . $language_title . ': </label></bdo>';
69 $retval .= '<select name="lang" class="autosubmit" lang="en"'
70 . ' dir="ltr" id="sel-lang">';
72 uasort($GLOBALS['available_languages'], 'PMA_languageCmp');
73 foreach ($GLOBALS['available_languages'] as $id => $tmplang) {
74 $lang_name = PMA_languageName($tmplang);
76 //Is current one active?
78 $selected = ' selected="selected"';
82 $retval .= '<option value="' . $id . '"' . $selected . '>';
83 $retval .= $lang_name;
84 $retval .= '</option>';
87 $retval .= '</select>';
90 $retval .= '</fieldset>';