3.4.9
[phpmyadmin/alexukf.git] / libraries / display_select_lang.lib.php
blob5ce059953de0d715ebd56eba34529445cfc708d7
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Code for displaying language selection
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Sorts available languages by their true english names
15 * @param array the array to be sorted
16 * @param mixed a required parameter
17 * @return the sorted array
18 * @access private
20 function PMA_language_cmp(&$a, &$b) {
21 return (strcmp($a[1], $b[1]));
22 } // end of the 'PMA_language_cmp()' function
24 /**
25 * Displays for for language selection
27 * @access public
29 function PMA_select_language($use_fieldset = FALSE, $show_doc = TRUE) {
30 global $cfg, $lang;
33 <form method="post" action="index.php" target="_parent">
34 <?php
35 $_form_params = array(
36 'db' => $GLOBALS['db'],
37 'table' => $GLOBALS['table'],
39 echo PMA_generate_common_hidden_inputs($_form_params);
41 // For non-English, display "Language" with emphasis because it's
42 // not a proper word in the current language; we show it to help
43 // people recognize the dialog
44 $language_title = __('Language')
45 . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
46 if ($show_doc) {
47 $language_title .= PMA_showDocu('faq7_2');
49 if ($use_fieldset) {
50 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
51 } else {
52 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
56 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
57 <?php
59 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
60 foreach ($GLOBALS['available_languages'] as $id => $tmplang) {
61 $lang_name = PMA_langName($tmplang);
63 //Is current one active?
64 if ($lang == $id) {
65 $selected = ' selected="selected"';
66 } else {
67 $selected = '';
70 echo ' ';
71 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
72 . '</option>' . "\n";
76 </select>
77 <?php
78 if ($use_fieldset) {
79 echo '</fieldset>';
83 <noscript>
84 <?php
85 if ($use_fieldset) {
86 echo '<fieldset class="tblFooters">';
90 <input type="submit" value="Go" />
91 <?php
92 if ($use_fieldset) {
93 echo '</fieldset>';
97 </noscript>
98 </form>
99 <?php
100 } // End of function PMA_select_language