The branch, master has been updated via 7337fe5a0c74817214004b5524850f5a166046d4 (commit) from f5a11a3f647332fe109af17c1af4246aec096648 (commit)
- Log ----------------------------------------------------------------- commit 7337fe5a0c74817214004b5524850f5a166046d4 Author: Michal Čihař mcihar@novell.com Date: Fri Apr 9 15:14:54 2010 +0200
Factor out code for getting language name.
-----------------------------------------------------------------------
Summary of changes: libraries/display_select_lang.lib.php | 8 +------- libraries/select_lang.lib.php | 14 ++++++++++++++ setup/frames/index.inc.php | 14 ++------------ 3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/libraries/display_select_lang.lib.php b/libraries/display_select_lang.lib.php index f91ea0a..b9a164c 100644 --- a/libraries/display_select_lang.lib.php +++ b/libraries/display_select_lang.lib.php @@ -62,13 +62,7 @@ function PMA_select_language($use_fieldset = FALSE, $show_doc = TRUE) {
uasort($GLOBALS['available_languages'], 'PMA_language_cmp'); foreach ($GLOBALS['available_languages'] as $id => $tmplang) { - $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1)); - - // Include native name if non empty - if (!empty($tmplang[2])) { - $lang_name = $tmplang[2] . ' - ' - . $lang_name; - } + $lang_name = PMA_langName($tmplang);
//Is current one active? if ($lang == $id) { diff --git a/libraries/select_lang.lib.php b/libraries/select_lang.lib.php index 0f1ba8a..25ba464 100644 --- a/libraries/select_lang.lib.php +++ b/libraries/select_lang.lib.php @@ -11,6 +11,20 @@ if (! defined('PHPMYADMIN')) { }
/** + * Returns language name + */ +function PMA_langName($tmplang) { + $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1)); + + // Include native name if non empty + if (!empty($tmplang[2])) { + $lang_name = $tmplang[2] . ' - ' . $lang_name; + } + + return $lang_name; +} + +/** * tries to find the language to use * * @uses $GLOBALS['cfg']['lang'] diff --git a/setup/frames/index.inc.php b/setup/frames/index.inc.php index 2da815b..aaa44be 100644 --- a/setup/frames/index.inc.php +++ b/setup/frames/index.inc.php @@ -74,13 +74,7 @@ if (!$is_https) { // create language list $lang_list = array(); foreach ($all_languages as $each_lang_key => $each_lang) { - - $lang_name = ucfirst(substr(strrchr($each_lang[0], '|'), 1)); - // Include native name if non empty - if (!empty($each_lang[2])) { - $lang_name = $each_lang[2] . ' - ' . $lang_name; - } - + $lang_name = PMA_langName($each_lang); //Is current one active? $selected = ($GLOBALS['lang'] == $each_lang_key) ? ' selected="selected"' : ''; echo '<option value="' . $each_lang_key . '"' . $selected . '>' . $lang_name @@ -172,11 +166,7 @@ $opts = array( 'values' => array(), 'values_escaped' => true); foreach ($all_languages as $each_lang_key => $each_lang) { - $lang_name = ucfirst(substr(strrchr($each_lang[0], '|'), 1)); - // Include native name if non empty - if (!empty($each_lang[2])) { - $lang_name = $each_lang[2] . ' - ' . $lang_name; - } + $lang_name = PMA_langName($each_lang); $opts['values'][$each_lang_key] = $lang_name; } display_input('DefaultLang', $GLOBALS['strSetupDefaultLanguage'], '', 'select',
hooks/post-receive