diff options
| author | czaks <marcin@6irc.net> | 2015-04-05 16:26:32 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2015-04-05 16:26:32 +0200 |
| commit | cbbebcd20ced5874b97452babbffdbc6d2278d58 (patch) | |
| tree | ba8071ff071fa0bb945210029f9dbac500e92d85 /inc | |
| parent | 1f9e36868e82fe563028f8c35aaee3c9ba21fa23 (diff) | |
optimization: if gettext.so is loaded, we don`t need the fallback implementation
Diffstat (limited to 'inc')
| -rwxr-xr-x | inc/functions.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/inc/functions.php b/inc/functions.php index 7ed3af5a..76b1d9a8 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -19,7 +19,9 @@ require_once 'inc/database.php'; require_once 'inc/events.php'; require_once 'inc/api.php'; require_once 'inc/bans.php'; -require_once 'inc/lib/gettext/gettext.inc'; +if (!extension_loaded('gettext')) { + require_once 'inc/lib/gettext/gettext.inc'; +} // the user is not currently logged in as a moderator $mod = false; @@ -29,14 +31,17 @@ mb_internal_encoding('UTF-8'); loadConfig(); function init_locale($locale, $error='error') { - if (_setlocale(LC_ALL, $locale) === false) { - $error('The specified locale (' . $locale . ') does not exist on your platform!'); - } if (extension_loaded('gettext')) { + if (setlocale(LC_ALL, $locale) === false) { + $error('The specified locale (' . $locale . ') does not exist on your platform!'); + } bindtextdomain('tinyboard', './inc/locale'); bind_textdomain_codeset('tinyboard', 'UTF-8'); textdomain('tinyboard'); } else { + if (_setlocale(LC_ALL, $locale) === false) { + $error('The specified locale (' . $locale . ') does not exist on your platform!'); + } _bindtextdomain('tinyboard', './inc/locale'); _bind_textdomain_codeset('tinyboard', 'UTF-8'); _textdomain('tinyboard'); |
