From: Reini U. <ru...@us...> - 2004-03-17 19:46:02
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23014 Modified Files: config.php Log Message: if LANG is not set Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.89 retrieving revision 1.90 diff -u -2 -b -p -d -r1.89 -r1.90 --- config.php 14 Mar 2004 16:32:18 -0000 1.89 +++ config.php 17 Mar 2004 19:36:31 -0000 1.90 @@ -85,8 +85,8 @@ function guessing_setlocale ($category, if ($res = setlocale($category, $locale)) return $res; -// gettext problem on windows $alt = array('en' => array('C', 'en_US', 'en_GB', 'en_AU', 'en_CA', 'english'), - 'de' => array('de_DE', 'German_Austria.1252', 'de_DE@euro', 'de_AT@euro', 'deutsch', - 'german', 'German', 'de_AT', 'ge'), + 'de' => array('de_DE', 'de_DE', 'de_DE@euro', + 'de_AT@euro', 'de_AT', 'German_Austria.1252', 'deutsch', + 'german', 'German', 'ge'), 'es' => array('es_ES', 'es_MX', 'es_AR', 'spanish'), 'nl' => array('nl_NL', 'dutch'), @@ -96,5 +96,7 @@ function guessing_setlocale ($category, 'ja' => array('ja_JP','ja_JP.eucJP') ); - + if (strlen($locale) == 2) + $lang = $locale; + else list ($lang) = split('_', $locale); if (!isset($alt[$lang])) @@ -102,5 +104,7 @@ function guessing_setlocale ($category, foreach ($alt[$lang] as $try) { - // Try first with charset appended... + if ($res = setlocale($category, $try)) + return $res; + // Try with charset appended... $try = $try . '.' . CHARSET; if ($res = setlocale($category, $try)) @@ -124,5 +128,5 @@ function update_locale($loc) { $newlocale = guessing_setlocale(LC_ALL, $loc); if (!$newlocale) { - trigger_error(sprintf(_("Can't set locale: '%s'"), $loc), E_USER_NOTICE); + trigger_error(sprintf(_("Can't setlocale(LC_ALL,'%s')"), $loc), E_USER_NOTICE); // => LC_COLLATE=C;LC_CTYPE=German_Austria.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C $loc = setlocale(LC_CTYPE, ''); // pull locale from environment. @@ -383,5 +387,5 @@ if (!defined('THEME')) define('THEME', 'default'); -update_locale(DEFAULT_LANGUAGE); +update_locale(isset($LANG) ? $LANG : DEFAULT_LANGUAGE); if (!defined('WIKI_NAME')) |