From 8d34866636a85c555e29c29dbd35a09355d0993d Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 3 Dec 2014 00:17:24 -0800 Subject: [PATCH] Fix locale bugs, init_locale was not calling setlocale!? --- inc/functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 0ff32e37..7d0cc9a3 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -29,14 +29,16 @@ 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 ($locale === 'en') + $locale = 'en_US.utf8'; + if (extension_loaded('gettext')) { + setlocale(LC_ALL, $locale); bindtextdomain('tinyboard', './inc/locale'); bind_textdomain_codeset('tinyboard', 'UTF-8'); textdomain('tinyboard'); } else { + _setlocale(LC_ALL, $locale); _bindtextdomain('tinyboard', './inc/locale'); _bind_textdomain_codeset('tinyboard', 'UTF-8'); _textdomain('tinyboard');