250 |
kaklik |
1 |
<?php |
|
|
2 |
/* |
|
|
3 |
* Code for displaying language selection |
|
|
4 |
* $Id: display_select_lang.lib.php,v 1.8 2005/11/27 22:04:10 nijel Exp $ |
|
|
5 |
*/ |
|
|
6 |
|
|
|
7 |
/** |
|
|
8 |
* Sorts available languages by their true english names |
|
|
9 |
* |
|
|
10 |
* @param array the array to be sorted |
|
|
11 |
* @param mixed a required parameter |
|
|
12 |
* @return the sorted array |
|
|
13 |
* @access private |
|
|
14 |
*/ |
|
|
15 |
function PMA_language_cmp( &$a, &$b ) { |
|
|
16 |
return (strcmp($a[1], $b[1])); |
|
|
17 |
} // end of the 'PMA_language_cmp()' function |
|
|
18 |
|
|
|
19 |
/** |
|
|
20 |
* Displays for for language selection |
|
|
21 |
* |
|
|
22 |
* @access public |
|
|
23 |
*/ |
|
|
24 |
function PMA_select_language($use_fieldset = FALSE) { |
|
|
25 |
global $cfg, $lang; |
|
|
26 |
?> |
|
|
27 |
|
|
|
28 |
<form method="post" action="index.php" target="_parent"> |
|
|
29 |
<?php |
|
|
30 |
if (isset($GLOBALS['collation_connection'])) { |
|
|
31 |
echo ' <input type="hidden" name="collation_connection" value="' |
|
|
32 |
. htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n"; |
|
|
33 |
} |
|
|
34 |
if (isset($GLOBALS['convcharset'])) { |
|
|
35 |
echo ' <input type="hidden" name="convcharset" value="' |
|
|
36 |
. htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n"; |
|
|
37 |
} |
|
|
38 |
if (isset($GLOBALS['db'])) { |
|
|
39 |
echo ' <input type="hidden" name="db" value="' |
|
|
40 |
. htmlspecialchars($GLOBALS['db']) . '" />' . "\n"; |
|
|
41 |
} |
|
|
42 |
if (isset($GLOBALS['table'])) { |
|
|
43 |
echo ' <input type="hidden" name="table" value="' |
|
|
44 |
. htmlspecialchars($GLOBALS['table']) . '" />' . "\n"; |
|
|
45 |
} |
|
|
46 |
if (isset($GLOBALS['server'])) { |
|
|
47 |
echo ' <input type="hidden" name="server" value="' |
|
|
48 |
. ((int)$GLOBALS['server']) . '" />' . "\n"; |
|
|
49 |
} |
|
|
50 |
|
|
|
51 |
$language_title = 'Language <a href="./translators.html" target="documentation">' . |
|
|
52 |
( $cfg['ReplaceHelpImg'] ? |
|
|
53 |
'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' : |
|
|
54 |
'(*)' ) . '</a>'; |
|
|
55 |
if ($use_fieldset) { |
|
|
56 |
echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>'; |
|
|
57 |
} else { |
|
|
58 |
echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>'; |
|
|
59 |
} |
|
|
60 |
?> |
|
|
61 |
|
|
|
62 |
<select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr"> |
|
|
63 |
<?php |
|
|
64 |
|
|
|
65 |
uasort($GLOBALS['available_languages'], 'PMA_language_cmp'); |
|
|
66 |
foreach ($GLOBALS['available_languages'] AS $id => $tmplang) { |
|
|
67 |
$lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1)); |
|
|
68 |
|
|
|
69 |
// Include native name if non empty |
|
|
70 |
if (!empty($tmplang[3])) { |
|
|
71 |
$lang_name = $tmplang[3] . ' - ' |
|
|
72 |
. $lang_name; |
|
|
73 |
} |
|
|
74 |
|
|
|
75 |
// Include charset if it makes sense |
|
|
76 |
if (!defined('PMA_REMOVED_NON_UTF_8')) { |
|
|
77 |
$lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')'; |
|
|
78 |
} |
|
|
79 |
|
|
|
80 |
//Is current one active? |
|
|
81 |
if ($lang == $id) { |
|
|
82 |
$selected = ' selected="selected"'; |
|
|
83 |
} else { |
|
|
84 |
$selected = ''; |
|
|
85 |
} |
|
|
86 |
|
|
|
87 |
echo ' '; |
|
|
88 |
echo '<option value="' . $id . '"' . $selected . '>' . $lang_name |
|
|
89 |
. '</option>' . "\n"; |
|
|
90 |
} |
|
|
91 |
?> |
|
|
92 |
|
|
|
93 |
</select> |
|
|
94 |
<?php |
|
|
95 |
if ($use_fieldset) { |
|
|
96 |
echo '</fieldset>'; |
|
|
97 |
} |
|
|
98 |
?> |
|
|
99 |
|
|
|
100 |
<noscript> |
|
|
101 |
<?php |
|
|
102 |
if ($use_fieldset) { |
|
|
103 |
echo '<fieldset class="tblFooters">'; |
|
|
104 |
} |
|
|
105 |
?> |
|
|
106 |
|
|
|
107 |
<input type="submit" value="Go" /> |
|
|
108 |
<?php |
|
|
109 |
if ($use_fieldset) { |
|
|
110 |
echo '</fieldset>'; |
|
|
111 |
} |
|
|
112 |
?> |
|
|
113 |
|
|
|
114 |
</noscript> |
|
|
115 |
</form> |
|
|
116 |
<?php |
|
|
117 |
} // End of function PMA_select_language |
|
|
118 |
?> |