1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-01 10:37:18 +01:00

Fix locale bugs, init_locale was not calling setlocale!?

This commit is contained in:
8chan 2014-12-03 00:17:24 -08:00
parent 6413bc78f6
commit 8d34866636

View File

@ -29,14 +29,16 @@ mb_internal_encoding('UTF-8');
loadConfig(); loadConfig();
function init_locale($locale, $error='error') { function init_locale($locale, $error='error') {
if (_setlocale(LC_ALL, $locale) === false) { if ($locale === 'en')
$error('The specified locale (' . $locale . ') does not exist on your platform!'); $locale = 'en_US.utf8';
}
if (extension_loaded('gettext')) { if (extension_loaded('gettext')) {
setlocale(LC_ALL, $locale);
bindtextdomain('tinyboard', './inc/locale'); bindtextdomain('tinyboard', './inc/locale');
bind_textdomain_codeset('tinyboard', 'UTF-8'); bind_textdomain_codeset('tinyboard', 'UTF-8');
textdomain('tinyboard'); textdomain('tinyboard');
} else { } else {
_setlocale(LC_ALL, $locale);
_bindtextdomain('tinyboard', './inc/locale'); _bindtextdomain('tinyboard', './inc/locale');
_bind_textdomain_codeset('tinyboard', 'UTF-8'); _bind_textdomain_codeset('tinyboard', 'UTF-8');
_textdomain('tinyboard'); _textdomain('tinyboard');