From a51f7c831adfd8260fed3224075ddda3bbb9ed1b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 21 May 2013 01:03:00 -0400 Subject: [PATCH] Make devgettext the default and only choice. This removes gettext as a system requirement, as MOReader will now always be used to read message catalogs. --- admin/index.php | 1 - admin/setting.php | 5 +---- docs/changes.txt | 4 ++++ includes/init.php | 18 ------------------ includes/language.php | 29 ++++------------------------- 5 files changed, 9 insertions(+), 48 deletions(-) diff --git a/admin/index.php b/admin/index.php index 5960dfc..7382cc3 100755 --- a/admin/index.php +++ b/admin/index.php @@ -76,7 +76,6 @@ $admin->row_text(T('PHP: Safe Mode'), ((ini_get('safe_mode') == 1 OR strtolower( $admin->row_text(T('PHP: Register Globals'), ((ini_get('register_globals') == 1 OR strtolower(ini_get('register_globals')) == 'on') ? T('Yes') : T('No'))); $admin->row_text(T('PHP: Magic Quotes GPC'), ((ini_get('magic_quotes_gpc') == 1 OR strtolower(ini_get('magic_quotes_gpc')) == 'on') ? T('Yes') : T('No'))); $admin->row_text(T('PHP: Magic Quotes Sybase'), ((ini_get('magic_quotes_sybase') == 1 OR strtolower(ini_get('magic_quotes_sybase')) == 'on') ? T('Yes') : T('No'))); -$admin->row_text(T('PHP: Gettext Installed'), (function_exists('ngettext') ? T('Yes') : T('No'))); // ------------------------------------------------------------------- diff --git a/admin/setting.php b/admin/setting.php index 98fc11d..bae5916 100755 --- a/admin/setting.php +++ b/admin/setting.php @@ -223,13 +223,10 @@ if ($_REQUEST['do'] == 'modify') { $admin->table_start(); $admin->table_head('Untouchables'); - + // trackerversion $admin->row_span('Version Number', 'thead'); $admin->row_input('Version Number', 'setting[trackerversion]', $bugsys->options['trackerversion']); - - $admin->row_span('Custom Gettext Localizer', 'thead'); - $admin->row_yesno('Use the custom MOReader implementation rather than the built-in Gettext extension.', 'setting[devgettext]', $bugsys->options['devgettext']); } // ################################################################### diff --git a/docs/changes.txt b/docs/changes.txt index 6959944..91431c8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,3 +1,7 @@ +2.0 +=============================== +- Change: The custom Gettext .mo reader added in 1.2.2 is now the default and only option for reading message catalogs + 1.2.4 =============================== - Fixed: #185: Quotes are unsanitized in search queries diff --git a/includes/init.php b/includes/init.php index 82acf50..9eb39c0 100755 --- a/includes/init.php +++ b/includes/init.php @@ -179,24 +179,6 @@ $stylevar['charset'] = $language['charset']; $stylevar['left'] = ($language['direction'] == 'ltr' ? 'left' : 'right'); $stylevar['right'] = ($language['direction'] == 'ltr' ? 'right' : 'left'); -// start gettext engine -if (!$bugsys->options['devgettext']) -{ - putenv("LANG=$language[langcode]"); - putenv("LANGUAGE=$language[langcode]"); - - setlocale(LC_ALL, $language['langcode']); - - bindtextdomain('MESSAGES', $bugsys->apppath . 'locale/'); - textdomain('MESSAGES'); - - bind_textdomain_codeset('MESSAGES', $language['charset']); -} -else -{ - $bugsys->debug("using custom MOReader instead of Gettext"); -} - require_once('./includes/definitions.php'); // ################################################################### diff --git a/includes/language.php b/includes/language.php index da95352..e5a17c2 100644 --- a/includes/language.php +++ b/includes/language.php @@ -19,20 +19,6 @@ || ################################################################### \*=====================================================================*/ -// ################################################################### -// for those who don't have gettext - -if (!function_exists('gettext')) -{ - function gettext($str) { return $str; } - function _($str) { return $str; } - function bindtextdomain() {} - function textdomain() {} - function bind_textdomain_codeset() {} - - $bugsys->debug('NOTICE: gettext not installed'); -} - // ################################################################### // LEXICAL STRING CONSTANTS @@ -73,12 +59,10 @@ function fetch_user_language() /** * Translation function. This will take in a native (English) string and return either - * a translated version or, if it cannot find one, the native string back. If the devgettext - * setting is enabled, this will use MOReader to load a .mo file, otherwise it will fall back onto - * making a call to _(), the built-in Gettext implementation. - * + * a translated version or, if it cannot find one, the native string back. + * * @param string Native string - * + * * @return string Translated string */ function T($str) @@ -86,11 +70,6 @@ function T($str) global $bugsys; static $mo; - if (!$bugsys->options['devgettext']) - { - return _($str); - } - if ($mo === null) { require_once './includes/class_mo.php'; @@ -102,7 +81,7 @@ function T($str) } $mo = new MOReader("locale/$info[langcode]/LC_MESSAGES/messages.mo"); } - + return $mo->T($str); } -- 2.22.5