From c5d9dadb8417788c88230591c14dd843b8e46212 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 29 Sep 2008 10:53:10 +0000 Subject: [PATCH] Added support for LC_CTYPE on SunOS and HP-UX, thanks to River for testing these. Neither of them like having a hyphen in UTF-8, so let's just use the exact string that locale -a returns. --- config/index.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/index.php b/config/index.php index c5a7dea21c..cc0d7b7fc9 100644 --- a/config/index.php +++ b/config/index.php @@ -1953,9 +1953,10 @@ function getShellLocale( $wikiLanguage ) { if ( wfIniGetBool( "safe_mode" ) || ini_get( 'open_basedir' ) ) { return false; } - - if ( php_uname( 's' ) != 'Linux' ) { - # TODO: need testing for other POSIX platforms + + $os = php_uname( 's' ); + $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these + if ( !in_array( $os, $supported ) ) { return false; } @@ -1977,7 +1978,7 @@ function getShellLocale( $wikiLanguage ) { continue; } list( $all, $lang, $territory, $charset, $modifier ) = $m; - $candidatesByLocale["$lang$territory.UTF-8$modifier"] = $m; + $candidatesByLocale[$m[0]] = $m; $candidatesByLang[$lang][] = $m; } @@ -1987,7 +1988,7 @@ function getShellLocale( $wikiLanguage ) { } # Try the most common ones - $commonLocales = array( 'en_US.UTF-8', 'de_DE.UTF-8' ); + $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' ); foreach ( $commonLocales as $commonLocale ) { if ( isset( $candidatesByLocale[$commonLocale] ) ) { return $commonLocale; -- 2.20.1