Translated using Weblate (Finnish)
[phpmyadmin.git] / libraries / display_select_lang.lib.php
blob0ff4c86cc43b22da141a82c0be0c0a21dff6e372
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 * 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]);
26 /**
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
32 * @return string
34 * @access public
36 function PMA_getLanguageSelectorHtml($use_fieldset = false, $show_doc = true)
38 global $lang;
40 $retval = '';
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>' : '');
58 if ($show_doc) {
59 $language_title .= PMA_Util::showDocu('faq', 'faq7-2');
61 if ($use_fieldset) {
62 $retval .= '<fieldset><legend lang="en" dir="ltr">'
63 . $language_title . '</legend>';
64 } else {
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?
77 if ($lang == $id) {
78 $selected = ' selected="selected"';
79 } else {
80 $selected = '';
82 $retval .= '<option value="' . $id . '"' . $selected . '>';
83 $retval .= $lang_name;
84 $retval .= '</option>';
87 $retval .= '</select>';
89 if ($use_fieldset) {
90 $retval .= '</fieldset>';
93 $retval .= '</form>';
95 return $retval;