From 1ea86684f4297f2b60f1fba6f75ed49691facda8 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 10 Jan 2006 22:53:40 +0000 Subject: [PATCH] Add gettext filter. fixes #2258 git-svn-id: https://develop.svn.wordpress.org/trunk@3425 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/wp-l10n.php | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/wp-includes/wp-l10n.php b/wp-includes/wp-l10n.php index 44393c5e56..2132943355 100644 --- a/wp-includes/wp-l10n.php +++ b/wp-includes/wp-l10n.php @@ -12,13 +12,11 @@ function get_locale() { return $locale; // WPLANG is defined in wp-config. - if (defined('WPLANG')) { - $locale = WPLANG; - } + if (defined('WPLANG')) + $locale = WPLANG; - if (empty($locale)) { - $locale = 'en_US'; - } + if (empty($locale)) + $locale = 'en_US'; $locale = apply_filters('locale', $locale); @@ -29,22 +27,20 @@ function get_locale() { function __($text, $domain = 'default') { global $l10n; - if (isset($l10n[$domain])) { - return $l10n[$domain]->translate($text); - } else { + if (isset($l10n[$domain])) + return apply_filters('gettext', $l10n[$domain]->translate($text), $text); + else return $text; - } } // Echo a translated string. function _e($text, $domain = 'default') { global $l10n; - if (isset($l10n[$domain])) { - echo $l10n[$domain]->translate($text); - } else { + if (isset($l10n[$domain])) + echo apply_filters('gettext', $l10n[$domain]->translate($text), $text); + else echo $text; - } } // Return the plural form. @@ -64,15 +60,13 @@ function __ngettext($single, $plural, $number, $domain = 'default') { function load_textdomain($domain, $mofile) { global $l10n; - if (isset($l10n[$domain])) { + if (isset($l10n[$domain])) return; - } - if ( is_readable($mofile)) { - $input = new CachedFileReader($mofile); - } else { + if ( is_readable($mofile)) + $input = new CachedFileReader($mofile); + else return; - } $l10n[$domain] = new gettext_reader($input); }