From: Andrew Dolgov Date: Fri, 18 Mar 2011 16:25:06 +0000 (+0300) Subject: config: remove ENABLE_TRANSLATIONS X-Git-Tag: 1.5.2~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7b26a148b0fcd904ea5425fd5d317b53704822dc;p=tt-rss.git config: remove ENABLE_TRANSLATIONS --- diff --git a/backend.php b/backend.php index 016e1898..fd5ad6e7 100644 --- a/backend.php +++ b/backend.php @@ -24,9 +24,7 @@ no_cache_incantation(); - if (ENABLE_TRANSLATIONS == true) { - startup_gettext(); - } + startup_gettext(); $script_started = getmicrotime(); diff --git a/config.php-dist b/config.php-dist index 320787d7..2fd065a5 100644 --- a/config.php-dist +++ b/config.php-dist @@ -82,9 +82,6 @@ // If update daemon and update_feeds should send digests // Disable if you prefer querying special URL (see wiki) - define('ENABLE_TRANSLATIONS', true); - // Enable support for interface translations - define('MYSQL_CHARSET', 'UTF8'); // Connection charset for MySQL. If you have a legacy database and/or experience // garbage unicode characters with this option, try setting it to a blank string. diff --git a/functions.php b/functions.php index 1e9e5a57..2fe066f2 100644 --- a/functions.php +++ b/functions.php @@ -42,60 +42,47 @@ return $tr; } - if (ENABLE_TRANSLATIONS == true) { // If translations are enabled. - require_once "lib/accept-to-gettext.php"; - require_once "lib/gettext/gettext.inc"; + require_once "lib/accept-to-gettext.php"; + require_once "lib/gettext/gettext.inc"; - function startup_gettext() { + function startup_gettext() { - # Get locale from Accept-Language header - $lang = al2gt(array_keys(get_translations()), "text/html"); + # Get locale from Accept-Language header + $lang = al2gt(array_keys(get_translations()), "text/html"); - if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) { - $lang = _TRANSLATION_OVERRIDE_DEFAULT; - } - - if ($_COOKIE["ttrss_lang"] && $_COOKIE["ttrss_lang"] != "auto") { - $lang = $_COOKIE["ttrss_lang"]; - } - - /* In login action of mobile version */ - if ($_POST["language"] && defined('MOBILE_VERSION')) { - $lang = $_POST["language"]; - $_COOKIE["ttrss_lang"] = $lang; - } + if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) { + $lang = _TRANSLATION_OVERRIDE_DEFAULT; + } - if ($lang) { - if (defined('LC_MESSAGES')) { - _setlocale(LC_MESSAGES, $lang); - } else if (defined('LC_ALL')) { - _setlocale(LC_ALL, $lang); - } else { - die("can't setlocale(): please set ENABLE_TRANSLATIONS to false in config.php"); - } + if ($_COOKIE["ttrss_lang"] && $_COOKIE["ttrss_lang"] != "auto") { + $lang = $_COOKIE["ttrss_lang"]; + } - if (defined('MOBILE_VERSION')) { - _bindtextdomain("messages", "../locale"); - } else { - _bindtextdomain("messages", "locale"); - } + /* In login action of mobile version */ + if ($_POST["language"] && defined('MOBILE_VERSION')) { + $lang = $_POST["language"]; + $_COOKIE["ttrss_lang"] = $lang; + } - _textdomain("messages"); - _bind_textdomain_codeset("messages", "UTF-8"); + if ($lang) { + if (defined('LC_MESSAGES')) { + _setlocale(LC_MESSAGES, $lang); + } else if (defined('LC_ALL')) { + _setlocale(LC_ALL, $lang); } - } - startup_gettext(); + if (defined('MOBILE_VERSION')) { + _bindtextdomain("messages", "../locale"); + } else { + _bindtextdomain("messages", "locale"); + } - } else { // If translations are enabled. - function __($msg) { - return $msg; + _textdomain("messages"); + _bind_textdomain_codeset("messages", "UTF-8"); } - function startup_gettext() { - // no-op - return true; - } - } // If translations are enabled. + } + + startup_gettext(); if (defined('MEMCACHE_SERVER')) { $memcache = new Memcache; diff --git a/localized_js.php b/localized_js.php index 08eec1af..e51e9731 100644 --- a/localized_js.php +++ b/localized_js.php @@ -3,7 +3,7 @@ require "functions.php"; header("Content-Type: text/plain; charset=UTF-8"); - + function T_js_decl($s1, $s2) { if ($s1 && $s2) { $s1 = preg_replace("/\n/", "", $s1); @@ -28,17 +28,12 @@ function __(msg) { } total; $i++) { + $orig = $l10n->get_original_string($i); + $translation = __($orig); - for ($i = 0; $i < $l10n->total; $i++) { - $orig = $l10n->get_original_string($i); - $translation = __($orig); - - print T_js_decl($orig, $translation); - } + print T_js_decl($orig, $translation); } - ?> diff --git a/localized_schema.php b/localized_schema.php index fab7953e..0fe45855 100644 --- a/localized_schema.php +++ b/localized_schema.php @@ -1,4 +1,4 @@ -); window.location.reload(); @@ -76,7 +76,7 @@ function bwLimitChange(elem) { try { var limit_set = elem.checked; - setCookie("ttrss_bwlimit", limit_set, + setCookie("ttrss_bwlimit", limit_set, ); } catch (e) { @@ -129,14 +129,13 @@ function validateLoginForm(f) { - - - @@ -188,7 +186,7 @@ function validateLoginForm(f) { diff --git a/sanity_config.php b/sanity_config.php index 7fafd224..f41beff4 100644 --- a/sanity_config.php +++ b/sanity_config.php @@ -1,3 +1,3 @@ - +$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MAGPIE_FETCH_TIME_OUT', 'MAGPIE_CACHE_DIR', 'MAGPIE_CACHE_AGE', 'ICONS_DIR', 'ICONS_URL', 'SINGLE_USER_MODE', 'TMP_DIRECTORY', 'ENABLE_UPDATE_DAEMON', 'DAEMON_SLEEP_INTERVAL', 'DATABASE_BACKED_SESSIONS', 'SESSION_CHECK_ADDRESS', 'SESSION_COOKIE_LIFETIME', 'SESSION_EXPIRE_TIME', 'DAEMON_UPDATE_LOGIN_LIMIT', 'CHECK_FOR_NEW_VERSION', 'DIGEST_ENABLE', 'DIGEST_EMAIL_LIMIT', 'DAEMON_SENDS_DIGESTS', 'MYSQL_CHARSET', 'DEFAULT_UPDATE_METHOD', 'SIMPLEPIE_CACHE_DIR', 'SIMPLEPIE_CACHE_IMAGES', 'COUNTERS_MAX_AGE', 'DIGEST_FROM_NAME', 'DIGEST_FROM_ADDRESS', 'DIGEST_SUBJECT', 'DIGEST_SMTP_HOST', 'DIGEST_SMTP_LOGIN', 'DIGEST_SMTP_PASSWORD', 'DAEMON_FEED_LIMIT', 'ALLOW_REMOTE_USER_AUTH', 'AUTO_LOGIN', 'LOCK_DIRECTORY', 'ENABLE_GZIP_OUTPUT', 'PHP_EXECUTABLE', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'FEEDBACK_URL', 'FORCE_ARTICLE_PURGE', 'SPHINX_ENABLED', 'SPHINX_INDEX', 'ENABLE_TWEET_BUTTON', 'CONSUMER_KEY', 'CONSUMER_SECRET', 'ISCONFIGURED', 'CONFIG_VERSION'); ?>
">
">
@@ -167,7 +165,7 @@ function validateLoginForm(f) { -
Tiny Tiny RSS - v + v © 2005– Andrew Dolgov