Changeset 1808 for trunk/wp-includes/wp-l10n.php
- Timestamp:
- 10/18/2004 02:27:35 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/wp-l10n.php
r1331 r1808 30 30 } 31 31 32 $l10n = new gettext_reader($input);32 $l10n['default'] = new gettext_reader($input); 33 33 34 34 // Return a translated string. 35 function __($text) { 36 global $l10n; 37 return $l10n->translate($text); 35 function __($text, $domain = 'default') { 36 global $l10n; 37 38 if (isset($l10n[$domain])) { 39 return $l10n[$domain]->translate($text); 40 } else { 41 return $text; 42 } 38 43 } 39 44 40 45 // Echo a translated string. 41 function _e($text) { 42 global $l10n; 43 echo $l10n->translate($text); 46 function _e($text, $domain = 'default') { 47 global $l10n; 48 49 if (isset($l10n[$domain])) { 50 echo $l10n[$domain]->translate($text); 51 } else { 52 echo $text; 53 } 44 54 } 45 55 46 56 // Return the plural form. 47 function __ngettext($single, $plural, $number) { 48 global $l10n; 49 return $l10n->ngettext($single, $plural, $number); 57 function __ngettext($single, $plural, $number, $domain = 'default') { 58 global $l10n; 59 60 if (isset($l10n[$domain])) { 61 return $l10n[$domain]->ngettext($single, $plural, $number); 62 } else { 63 return $text; 64 } 65 } 66 67 function load_textdomain($domain, $mofile) { 68 global $l10n; 69 70 if ( is_readable($mofile)) { 71 $input = new FileReader($mofile); 72 } else { 73 return; 74 } 75 76 $l10n[$domain] = new gettext_reader($input); 77 } 78 79 function load_plugin_textdomain($domain) { 80 global $locale; 81 82 $mofile = ABSPATH . "wp-content/plugins/$domain-$locale.mo"; 83 load_textdomain($domain, $mofile); 84 } 85 86 function load_theme_textdomain($domain) { 87 global $locale; 88 89 $mofile = get_template_directory() . "/$locale.mo""; 90 load_textdomain($domain, $mofile); 50 91 } 51 92
Note: See TracChangeset
for help on using the changeset viewer.