Ticket #2258: gettext-filter.diff
File gettext-filter.diff, 1.5 KB (added by , 19 years ago) |
---|
-
wp-includes/wp-l10n.php
12 12 return $locale; 13 13 14 14 // WPLANG is defined in wp-config. 15 if (defined('WPLANG')) { 16 $locale = WPLANG; 17 } 15 if (defined('WPLANG')) 16 $locale = WPLANG; 18 17 19 if (empty($locale)) { 20 $locale = 'en_US'; 21 } 18 if (empty($locale)) 19 $locale = 'en_US'; 22 20 23 21 $locale = apply_filters('locale', $locale); 24 22 … … 29 27 function __($text, $domain = 'default') { 30 28 global $l10n; 31 29 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 35 33 return $text; 36 }37 34 } 38 35 39 36 // Echo a translated string. 40 37 function _e($text, $domain = 'default') { 41 38 global $l10n; 42 39 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 46 43 echo $text; 47 }48 44 } 49 45 50 46 // Return the plural form. … … 64 60 function load_textdomain($domain, $mofile) { 65 61 global $l10n; 66 62 67 if (isset($l10n[$domain])) {63 if (isset($l10n[$domain])) 68 64 return; 69 }70 65 71 if ( is_readable($mofile)) {72 73 } else {66 if ( is_readable($mofile)) 67 $input = new CachedFileReader($mofile); 68 else 74 69 return; 75 }76 70 77 71 $l10n[$domain] = new gettext_reader($input); 78 72 }