diff options
author | Brion Vibber <brion@pobox.com> | 2009-10-19 09:25:05 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2009-10-19 09:25:05 -0700 |
commit | 39598582d90eab2a8abaf2ca01bcad6cb09d2c73 (patch) | |
tree | 0402d9e18a8956fe58eaa62c77fc7b9c5c87d672 /lib/util.php | |
parent | e48efd322279fd67168957635fa30cf4cb46f81b (diff) | |
parent | b3c29800fbf7bd44f043e0c9742b207e15fb50f2 (diff) |
Merge branch 'i18n-work' into i18n-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__); } |