diff options
author | Paul Arthur <flowerysong00@yahoo.com> | 2012-03-31 17:00:20 -0400 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2012-04-12 21:13:29 -0400 |
commit | 5a9fba98cee095c9501259236745bfb8ceffa0f3 (patch) | |
tree | 8897d954266c043bc056495998a5cc31802d0a5c | |
parent | fc81208797360b6c3878f107d83886b90672a76b (diff) | |
download | ampache-5a9fba98cee095c9501259236745bfb8ceffa0f3.tar.gz ampache-5a9fba98cee095c9501259236745bfb8ceffa0f3.tar.bz2 ampache-5a9fba98cee095c9501259236745bfb8ceffa0f3.zip |
Clean up gettext initialisation
Doesn't need all the conditionals. Switch to using the wrapper library.
-rw-r--r-- | lib/i18n.php (renamed from lib/gettext.php) | 32 | ||||
-rw-r--r-- | lib/init-tiny.php | 2 |
2 files changed, 11 insertions, 23 deletions
diff --git a/lib/gettext.php b/lib/i18n.php index 127f94c9..ddc946d1 100644 --- a/lib/gettext.php +++ b/lib/i18n.php @@ -33,28 +33,16 @@ * @return void */ function load_gettext() { - /* If we have gettext */ - if (function_exists('bindtextdomain')) { - $lang = Config::get('lang'); - putenv("LANG=" . $lang); - putenv("LANGUAGE=" . $lang); - /* Try lang, lang + charset and lang + utf-8 */ - setlocale(LC_ALL, - $lang, - $lang . '.UTF-8', //. Config::get('site_charset'), - $lang . '.UTF-8', - $lang . '.UTF-8', - $lang . '.UTF-8'); // . Config::get('lc_charset')); - - /* Bind the Text Domain */ - bindtextdomain('messages', Config::get('prefix') . "/locale/"); - textdomain('messages'); - if (function_exists('bind_textdomain_codeset')) { - bind_textdomain_codeset('messages',Config::get('site_charset')); - } // if we can codeset the textdomain - - } // If bindtext domain exists - + $lang = Config::get('lang'); + $charset = Config::get('site_charset') ?: 'UTF=8'; + $locale = $lang . '.' . $charset; + debug_event('i18n', 'Setting locale to ' . $locale, 5); + T_setlocale(LC_MESSAGES, $locale); + /* Bind the Text Domain */ + T_bindtextdomain('messages', Config::get('prefix') . "/locale/"); + T_bind_textdomain_codeset('messages', $charset); + T_textdomain('messages'); + debug_event('i18n', 'gettext is ' . (locale_emulation() ? 'emulated' : 'native'), 5); } // load_gettext /** diff --git a/lib/init-tiny.php b/lib/init-tiny.php index 1bd85b58..ae4c70bc 100644 --- a/lib/init-tiny.php +++ b/lib/init-tiny.php @@ -64,7 +64,7 @@ require_once $prefix . '/lib/preferences.php'; require_once $prefix . '/lib/debug.lib.php'; require_once $prefix . '/lib/log.lib.php'; require_once $prefix . '/lib/ui.lib.php'; -require_once $prefix . '/lib/gettext.php'; +require_once $prefix . '/lib/i18n.php'; require_once $prefix . '/lib/batch.lib.php'; require_once $prefix . '/lib/themes.php'; require_once $prefix . '/lib/class/localplay.abstract.php'; |