From: Reini U. <ru...@us...> - 2005-03-27 18:23:50
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24626 Modified Files: config.php IniConfig.php Log Message: compute locale only for setlocale and LC_ALL Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.133 retrieving revision 1.134 diff -u -2 -b -p -d -r1.133 -r1.134 --- config.php 8 Feb 2005 13:26:59 -0000 1.133 +++ config.php 27 Mar 2005 18:23:39 -0000 1.134 @@ -129,5 +129,5 @@ function guessing_lang ($languages=false // make this faster $languages = array("en","de","es","fr","it","ja","zh","nl","sv"); - // ignore possible "_territory" and codeset "ja.utf8" + // ignore possible "_<territory>" and codeset "ja.utf8" /* require_once("lib/Theme.php"); @@ -270,12 +270,10 @@ function update_locale($loc) { // $LANG or DEFAULT_LANGUAGE is too less information, at least on unix for // setlocale(), for bindtextdomain() to succeed. - $newlocale = guessing_setlocale(LC_ALL, $loc); // [56ms] - if (!$newlocale) { - $newlocale = FileFinder::_get_lang(); - list ($newlocale,) = split('_', $newlocale, 2); - $loc = guessing_setlocale(LC_ALL, $newlocale); // try again - if (!$loc) $loc = $newlocale; - } else { - $loc = $newlocale; + $setlocale = guessing_setlocale(LC_ALL, $loc); // [56ms] + if (!$setlocale) { // system has no locale for this language, so gettext might fail + $setlocale = FileFinder::_get_lang(); + list ($setlocale,) = split('_', $setlocale, 2); + $setlocale = guessing_setlocale(LC_ALL, $setlocale); // try again + if (!$setlocale) $setlocale = $loc; } // Try to put new locale into environment (so any @@ -292,5 +290,5 @@ function update_locale($loc) { // If PHP is in safe mode, this is not allowed, // so hide errors... - @putenv("LC_ALL=$loc"); + @putenv("LC_ALL=$setlocale"); @putenv("LANG=$loc"); @putenv("LANGUAGE=$loc"); @@ -318,5 +316,5 @@ function update_locale($loc) { $x = setlocale(LC_CTYPE, 'en_US.' . $GLOBALS['charset']); } else { - $x = setlocale(LC_CTYPE, $loc); + $x = setlocale(LC_CTYPE, $setlocale); } @@ -529,4 +527,7 @@ function getUploadDataPath() { // $Log$ +// Revision 1.134 2005/03/27 18:23:39 rurban +// compute locale only for setlocale and LC_ALL +// // Revision 1.133 2005/02/08 13:26:59 rurban // improve the locale splitter Index: IniConfig.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/IniConfig.php,v retrieving revision 1.83 retrieving revision 1.84 diff -u -2 -b -p -d -r1.83 -r1.84 --- IniConfig.php 28 Feb 2005 21:24:32 -0000 1.83 +++ IniConfig.php 27 Mar 2005 18:23:40 -0000 1.84 @@ -682,5 +682,5 @@ function fixup_dynamic_configs($file) { $bindtextdomain_path = str_replace("/", "\\", $bindtextdomain_path); $bindtextdomain_real = @bindtextdomain("phpwiki", $bindtextdomain_path); - if ($bindtextdomain_real != $bindtextdomain_path) { + if (realpath($bindtextdomain_real) != realpath($bindtextdomain_path)) { // this will happen with virtual_paths. chdir and try again. chdir($bindtextdomain_path); @@ -831,4 +831,7 @@ function fixup_dynamic_configs($file) { // $Log$ +// Revision 1.84 2005/03/27 18:23:40 rurban +// compute locale only for setlocale and LC_ALL +// // Revision 1.83 2005/02/28 21:24:32 rurban // ignore forbidden ini_set warnings. Bug #1117254 by Xavier Roche |