diff options
author | Evan Prodromou <evan@status.net> | 2009-10-19 15:36:26 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-10-19 15:36:26 -0400 |
commit | 035d4cf86e8cd2bec46a9b24e098c798f3ec3cb3 (patch) | |
tree | de92e5245dffd047460b60425a3d4035d84d0435 /lib/util.php | |
parent | 90de6eae5a6195e4455a726d7183dbefc8eeb617 (diff) | |
parent | ce4ed6cca54134152c11baf8e0d0ff5b587b4998 (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/util.php')
-rw-r--r-- | lib/util.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/util.php b/lib/util.php index be10647fc..e9ae2bd50 100644 --- a/lib/util.php +++ b/lib/util.php @@ -51,13 +51,23 @@ function common_init_locale($language=null) function common_init_language() { mb_internal_encoding('UTF-8'); + + // gettext seems very picky... We first need to setlocale() + // to a locale which _does_ exist on the system, and _then_ + // we can set in another locale that may not be set up + // (say, ga_ES for Galego/Galician) it seems to take it. + common_init_locale("en_US"); + $language = common_language(); - // So we don't have to make people install the gettext locales $locale_set = common_init_locale($language); - bindtextdomain("statusnet", common_config('site','locale_path')); + setlocale(LC_CTYPE, 'C'); + + // So we don't have to make people install the gettext locales + $path = common_config('site','locale_path'); + bindtextdomain("statusnet", $path); bind_textdomain_codeset("statusnet", "UTF-8"); textdomain("statusnet"); - setlocale(LC_CTYPE, 'C'); + if(!$locale_set) { common_log(LOG_INFO, 'Language requested:' . $language . ' - locale could not be set. Perhaps that system locale is not installed.', __FILE__); } |