do not reference gettext modules if ENABLE_TRANSLATIONS is disabled

This commit is contained in:
Andrew Dolgov 2007-05-19 05:46:29 +01:00
parent c4b0f96c81
commit 8d03971834
2 changed files with 30 additions and 16 deletions

View file

@ -20,7 +20,10 @@
require_once "functions.php"; require_once "functions.php";
no_cache_incantation(); no_cache_incantation();
startup_gettext();
if (ENABLE_TRANSLATIONS == true) {
startup_gettext();
}
$script_started = getmicrotime(); $script_started = getmicrotime();

View file

@ -6,25 +6,36 @@
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE); define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
} */ } */
require_once "accept-to-gettext.php"; if (ENABLE_TRANSLATIONS == true) {
require_once "gettext/gettext.inc"; require_once "accept-to-gettext.php";
require_once "gettext/gettext.inc";
require_once 'config.php'; } else {
function __($msg) {
function startup_gettext() { return $msg;
}
# Get locale from Accept-Language header function startup_gettext() {
$lang = al2gt(array("en_US", "ru_RU"), "text/html"); // no-op
return true;
if ($lang) {
_setlocale(LC_MESSAGES, $lang);
_bindtextdomain("messages", "locale");
_textdomain("messages");
_bind_textdomain_codeset("messages", "UTF-8");
} }
} }
require_once 'config.php';
if (ENABLE_TRANSLATIONS == true) { if (ENABLE_TRANSLATIONS == true) {
function startup_gettext() {
# Get locale from Accept-Language header
$lang = al2gt(array("en_US", "ru_RU"), "text/html");
if ($lang) {
_setlocale(LC_MESSAGES, $lang);
_bindtextdomain("messages", "locale");
_textdomain("messages");
_bind_textdomain_codeset("messages", "UTF-8");
}
}
startup_gettext(); startup_gettext();
} }