From: tokul Date: Wed, 15 Mar 2006 17:17:13 +0000 (+0000) Subject: adding supported locale tests and displaying current server's time zone. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fd72907b14fc668e47f413d4fcc58e1a4a0f045d;p=squirrelmail.git adding supported locale tests and displaying current server's time zone. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10987 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/configtest.php b/src/configtest.php index 5982b162..0d6be68a 100644 --- a/src/configtest.php +++ b/src/configtest.php @@ -476,6 +476,52 @@ if (function_exists('gettext')) { echo 'Gettext functions are available.' .' On some systems you must have appropriate system locales compiled.' ."
\n"; + + /* optional setlocale() tests. Should work only on glibc systems. */ + if (sqgetGlobalVar('testlocales',$testlocales,SQ_GET)) { + include_once(SM_PATH . 'functions/i18n.php'); + echo $IND . $IND . 'Testing translations:
'; + foreach ($languages as $lang_code => $lang_data) { + /* don't test aliases */ + if (isset($lang_data['NAME'])) { + /* locale can be $lang_code or $lang_data['LOCALE'] */ + if (isset($lang_data['LOCALE'])) { + $setlocale = $lang_data['LOCALE']; + } else { + $setlocale = $lang_code; + } + /* prepare information about tested locales */ + if (is_array($setlocale)) { + $display_locale = implode(', ',$setlocale); + $locale_count = count($setlocale); + } else { + $display_locale = $setlocale; + $locale_count = 1; + } + $tested_locales_msg = 'Tested '.htmlspecialchars($display_locale).' ' + .($locale_count>1 ? 'locales':'locale'). '.'; + + echo $IND . $IND .$IND . $lang_data['NAME'].' (' .$lang_code. ') - '; + $retlocale = sq_setlocale(LC_ALL,$setlocale); + if (is_bool($retlocale)) { + echo 'unsupported. '; + echo $tested_locales_msg; + } else { + echo 'supported. ' + .$tested_locales_msg + .' setlocale() returned "'.htmlspecialchars($retlocale).'"'; + } + echo "
\n"; + } + } + echo $IND . $IND . 'Don\'t test translations'; + } else { + echo $IND . $IND . 'Test translations. ' + .'This test is not accurate and might work only on some systems.' + ."\n"; + } + echo "
\n"; + /* end of translation tests */ } else { echo 'Gettext functions are unavailable.' .' SquirrelMail will use slower internal gettext functions.' @@ -511,11 +557,16 @@ echo "$IND timezone - "; if ( (!ini_get('safe_mode')) || !strcmp(ini_get('safe_mode_allowed_env_vars'),'') || preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars')) ) { - echo "Webmail users can change their time zone settings.
\n"; + echo "Webmail users can change their time zone settings. \n"; } else { - echo "Webmail users can't change their time zone settings.
\n"; + echo "Webmail users can't change their time zone settings. \n"; } - +if (isset($_ENV['TZ'])) { + echo 'Default time zone is '.htmlspecialchars($_ENV['TZ']); +} else { + echo 'Current time zone is '.date('T'); +} +echo ".
\n"; // Pear DB tests echo "Checking database functions...
\n";