Make WordPress Core

Ticket #2258: gettext-filter.diff

File gettext-filter.diff, 1.5 KB (added by skeltoac, 19 years ago)
  • wp-includes/wp-l10n.php

     
    1212                return $locale;
    1313
    1414        // WPLANG is defined in wp-config.
    15         if (defined('WPLANG')) {
    16     $locale = WPLANG;
    17         }
     15        if (defined('WPLANG'))
     16                $locale = WPLANG;
    1817       
    19         if (empty($locale)) {
    20     $locale = 'en_US';
    21         }
     18        if (empty($locale))
     19                $locale = 'en_US';
    2220
    2321        $locale = apply_filters('locale', $locale);
    2422
     
    2927function __($text, $domain = 'default') {
    3028        global $l10n;
    3129
    32         if (isset($l10n[$domain])) {
    33                 return $l10n[$domain]->translate($text);
    34         } else {
     30        if (isset($l10n[$domain]))
     31                return apply_filters('gettext', $l10n[$domain]->translate($text), $text);
     32        else
    3533                return $text;
    36         }
    3734}
    3835
    3936// Echo a translated string.
    4037function _e($text, $domain = 'default') {
    4138        global $l10n;
    4239
    43         if (isset($l10n[$domain])) {
    44                 echo $l10n[$domain]->translate($text);
    45         } else {
     40        if (isset($l10n[$domain]))
     41                echo apply_filters('gettext', $l10n[$domain]->translate($text), $text);
     42        else
    4643                echo $text;
    47         }
    4844}
    4945
    5046// Return the plural form.
     
    6460function load_textdomain($domain, $mofile) {
    6561        global $l10n;
    6662
    67         if (isset($l10n[$domain])) {
     63        if (isset($l10n[$domain]))
    6864                return;
    69         }
    7065
    71         if ( is_readable($mofile)) {
    72     $input = new CachedFileReader($mofile);
    73         }       else {
     66        if ( is_readable($mofile))
     67                $input = new CachedFileReader($mofile);
     68        else
    7469                return;
    75         }
    7670
    7771        $l10n[$domain] = new gettext_reader($input);
    7872}