1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

optimization: if gettext.so is loaded, we don`t need the fallback implementation

This commit is contained in:
czaks 2015-04-05 16:26:32 +02:00
parent 1f9e36868e
commit cbbebcd20c

View File

@ -19,7 +19,9 @@ require_once 'inc/database.php';
require_once 'inc/events.php';
require_once 'inc/api.php';
require_once 'inc/bans.php';
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) {
if (extension_loaded('gettext')) {
if (setlocale(LC_ALL, $locale) === false) {
$error('The specified locale (' . $locale . ') does not exist on your platform!');
}
if (extension_loaded('gettext')) {
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');