[wp-cvs] wordpress/wp-includes wp-l10n.php,1.5,1.6

Ryan Boren rboren at users.sourceforge.net
Mon Oct 18 02:27:38 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2663

Modified Files:
	wp-l10n.php 
Log Message:
Plugin and theme localization.

Index: wp-l10n.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/wp-l10n.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** wp-l10n.php	21 May 2004 03:26:12 -0000	1.5
--- wp-l10n.php	18 Oct 2004 02:27:35 -0000	1.6
***************
*** 30,51 ****
  }
  
! $l10n = new gettext_reader($input);
  
  // Return a translated string.    
! function __($text) {
!     global $l10n;
!     return $l10n->translate($text);
  }
  
  // Echo a translated string.
! function _e($text) {
!     global $l10n;
!     echo $l10n->translate($text);
  }
  
  // Return the plural form.
! function __ngettext($single, $plural, $number) {
!     global $l10n;
!     return $l10n->ngettext($single, $plural, $number);
  }
  
--- 30,92 ----
  }
  
! $l10n['default'] = new gettext_reader($input);
  
  // Return a translated string.    
! function __($text, $domain = 'default') {
! 	global $l10n;
! 
! 	if (isset($l10n[$domain])) {
! 		return $l10n[$domain]->translate($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 {
! 		echo $text;
! 	}
  }
  
  // Return the plural form.
! function __ngettext($single, $plural, $number, $domain = 'default') {
! 	global $l10n;
! 
! 	if (isset($l10n[$domain])) {
! 		return $l10n[$domain]->ngettext($single, $plural, $number);
! 	} else {
! 		return $text;
! 	}
! }
! 
! function load_textdomain($domain, $mofile) {
! 	global $l10n;
! 
! 	if ( is_readable($mofile)) {
!     $input = new FileReader($mofile);
! 	}	else {
! 		return;
! 	}
! 
! 	$l10n[$domain] = new gettext_reader($input);
! }
! 
! function load_plugin_textdomain($domain) {
! 	global $locale;
! 	
! 	$mofile = ABSPATH . "wp-content/plugins/$domain-$locale.mo";
! 	load_textdomain($domain, $mofile);
! }
! 
! function load_theme_textdomain($domain) {
! 	global $locale;
! 	
! 	$mofile = get_template_directory() . "/$locale.mo"";
! 	load_textdomain($domain, $mofile);
  }
  




More information about the cvs mailing list