bug #2027102 quotes around lang missing
[phpmyadmin/last10db.git] / libraries / display_select_lang.lib.php
blobefce45bc576c51b1cc55646de3390cc9de076427
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Code for displaying language selection
6 * @version $Id$
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) {
30 global $cfg, $lang;
33 <form method="post" action="index.php" target="_parent">
34 <?php
35 if (isset($GLOBALS['collation_connection'])) {
36 echo ' <input type="hidden" name="collation_connection" value="'
37 . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
39 if (isset($GLOBALS['convcharset'])) {
40 echo ' <input type="hidden" name="convcharset" value="'
41 . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
43 if (strlen($GLOBALS['db'])) {
44 echo ' <input type="hidden" name="db" value="'
45 . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
47 if (strlen($GLOBALS['table'])) {
48 echo ' <input type="hidden" name="table" value="'
49 . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
51 if (isset($GLOBALS['server'])) {
52 echo ' <input type="hidden" name="server" value="'
53 . ((int)$GLOBALS['server']) . '" />' . "\n";
56 // For non-English, display "Language" with emphasis because it's
57 // not a proper word in the current language; we show it to help
58 // people recognize the dialog
59 $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - <em>Language</em>' : '') . ' <a href="./translators.html" target="documentation">' .
60 ($cfg['ReplaceHelpImg'] ?
61 '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
62 '(*)') . '</a>';
63 if ($use_fieldset) {
64 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
65 } else {
66 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
70 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
71 <?php
73 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
74 foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
75 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
77 // Include native name if non empty
78 if (!empty($tmplang[3])) {
79 $lang_name = $tmplang[3] . ' - '
80 . $lang_name;
83 // Include charset if it makes sense
84 if (!defined('PMA_REMOVED_NON_UTF_8')) {
85 $lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')';
88 //Is current one active?
89 if ($lang == $id) {
90 $selected = ' selected="selected"';
91 } else {
92 $selected = '';
95 echo ' ';
96 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
97 . '</option>' . "\n";
101 </select>
102 <?php
103 if ($use_fieldset) {
104 echo '</fieldset>';
108 <noscript>
109 <?php
110 if ($use_fieldset) {
111 echo '<fieldset class="tblFooters">';
115 <input type="submit" value="Go" />
116 <?php
117 if ($use_fieldset) {
118 echo '</fieldset>';
122 </noscript>
123 </form>
124 <?php
125 } // End of function PMA_select_language