3.3.6-rc1
[phpmyadmin/dkf.git] / libraries / display_select_lang.lib.php
blob831f8c5cc2921570c9f918466fa2ec9f37e55840
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Code for displaying language selection
6 * @version $Id$
7 * @package phpMyAdmin
8 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 /**
14 * Sorts available languages by their true english names
16 * @param array the array to be sorted
17 * @param mixed a required parameter
18 * @return the sorted array
19 * @access private
21 function PMA_language_cmp(&$a, &$b) {
22 return (strcmp($a[1], $b[1]));
23 } // end of the 'PMA_language_cmp()' function
25 /**
26 * Displays for for language selection
28 * @access public
30 function PMA_select_language($use_fieldset = FALSE, $show_doc = TRUE) {
31 global $cfg, $lang;
34 <form method="post" action="index.php" target="_parent">
35 <?php
36 $_form_params = array(
37 'db' => $GLOBALS['db'],
38 'table' => $GLOBALS['table'],
40 echo PMA_generate_common_hidden_inputs($_form_params);
42 // For non-English, display "Language" with emphasis because it's
43 // not a proper word in the current language; we show it to help
44 // people recognize the dialog
45 $language_title = $GLOBALS['strLanguage']
46 . ($GLOBALS['strLanguage'] != 'Language' ? ' - <em>Language</em>' : '');
47 if ($show_doc) {
48 $language_title .= ' <a href="./translators.html" target="documentation">' .
49 ($cfg['ReplaceHelpImg']
50 ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />'
51 : '(*)') . '</a>';
53 if ($use_fieldset) {
54 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
55 } else {
56 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
60 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
61 <?php
63 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
64 foreach ($GLOBALS['available_languages'] as $id => $tmplang) {
65 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
67 // Include native name if non empty
68 if (!empty($tmplang[3])) {
69 $lang_name = $tmplang[3] . ' - '
70 . $lang_name;
73 //Is current one active?
74 if ($lang == $id) {
75 $selected = ' selected="selected"';
76 } else {
77 $selected = '';
80 echo ' ';
81 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
82 . '</option>' . "\n";
86 </select>
87 <?php
88 if ($use_fieldset) {
89 echo '</fieldset>';
93 <noscript>
94 <?php
95 if ($use_fieldset) {
96 echo '<fieldset class="tblFooters">';
100 <input type="submit" value="Go" />
101 <?php
102 if ($use_fieldset) {
103 echo '</fieldset>';
107 </noscript>
108 </form>
109 <?php
110 } // End of function PMA_select_language