[ Index ] |
|
Code source de WordPress 2.1.2 |
1 <?php 2 function get_locale() { 3 global $locale; 4 5 if (isset($locale)) 6 return apply_filters( 'locale', $locale ); 7 8 // WPLANG is defined in wp-config. 9 if (defined('WPLANG')) 10 $locale = WPLANG; 11 12 if (empty($locale)) 13 $locale = ''; 14 15 $locale = apply_filters('locale', $locale); 16 17 return $locale; 18 } 19 20 // Return a translated string. 21 function __($text, $domain = 'default') { 22 global $l10n; 23 24 if (isset($l10n[$domain])) 25 return apply_filters('gettext', $l10n[$domain]->translate($text), $text); 26 else 27 return $text; 28 } 29 30 // Echo a translated string. 31 function _e($text, $domain = 'default') { 32 global $l10n; 33 34 if (isset($l10n[$domain])) 35 echo apply_filters('gettext', $l10n[$domain]->translate($text), $text); 36 else 37 echo $text; 38 } 39 40 // Return the plural form. 41 function __ngettext($single, $plural, $number, $domain = 'default') { 42 global $l10n; 43 44 if (isset($l10n[$domain])) { 45 return $l10n[$domain]->ngettext($single, $plural, $number); 46 } else { 47 if ($number != 1) 48 return $plural; 49 else 50 return $single; 51 } 52 } 53 54 function load_textdomain($domain, $mofile) { 55 global $l10n; 56 57 if (isset($l10n[$domain])) 58 return; 59 60 if ( is_readable($mofile)) 61 $input = new CachedFileReader($mofile); 62 else 63 return; 64 65 $l10n[$domain] = new gettext_reader($input); 66 } 67 68 function load_default_textdomain() { 69 global $l10n; 70 71 $locale = get_locale(); 72 if ( empty($locale) ) 73 $locale = 'en_US'; 74 75 $mofile = ABSPATH . LANGDIR . "/$locale.mo"; 76 77 load_textdomain('default', $mofile); 78 } 79 80 function load_plugin_textdomain($domain, $path = false) { 81 $locale = get_locale(); 82 if ( empty($locale) ) 83 $locale = 'en_US'; 84 85 if ( false === $path ) 86 $path = PLUGINDIR; 87 88 $mofile = ABSPATH . "$path/$domain-$locale.mo"; 89 load_textdomain($domain, $mofile); 90 } 91 92 function load_theme_textdomain($domain) { 93 $locale = get_locale(); 94 if ( empty($locale) ) 95 $locale = 'en_US'; 96 97 $mofile = get_template_directory() . "/$locale.mo"; 98 load_textdomain($domain, $mofile); 99 } 100 101 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 19:41:27 2007 | par Balluche grâce à PHPXref 0.7 |