[wp-cvs] wordpress/wp-includes wp-l10n.php, 1.7, 1.8 gettext.php, 1.2, 1.3

Ryan Boren rboren at users.sourceforge.net
Tue Oct 19 00:18:14 UTC 2004


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

Modified Files:
	wp-l10n.php gettext.php 
Log Message:
Default textdomain loading cleanup.  Fix for bug 230.

Index: wp-l10n.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/wp-l10n.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** wp-l10n.php	18 Oct 2004 04:38:49 -0000	1.7
--- wp-l10n.php	19 Oct 2004 00:18:11 -0000	1.8
***************
*** 4,9 ****
  require_once($parentpath.'/wp-config.php');
  
- $curpath = dirname(__FILE__).'/';
- 
  $locale = '';
  
--- 4,7 ----
***************
*** 17,34 ****
  }
  
! $mofile = $curpath . "languages/$locale.mo";
! 
! require($curpath . 'streams.php');
! require($curpath . 'gettext.php');
! 
! // If the mo file does not exist or is not readable, or if the locale is
! // en_US, do not load the mo.
! if ( is_readable($mofile) && ($locale != 'en_US') ) {
!     $input = new FileReader($mofile);
! } else {
!     $input = false;
! }
! 
! $l10n['default'] = new gettext_reader($input);
  
  // Return a translated string.    
--- 15,20 ----
  }
  
! require_once(ABSPATH . 'wp-includes/streams.php');
! require_once(ABSPATH . 'wp-includes/gettext.php');
  
  // Return a translated string.    
***************
*** 68,71 ****
--- 54,61 ----
  	global $l10n;
  
+ 	if (isset($l10n[$domain])) {
+ 		return;
+ 	}
+ 
  	if ( is_readable($mofile)) {
      $input = new FileReader($mofile);
***************
*** 77,80 ****
--- 67,78 ----
  }
  
+ function load_default_textdomain() {
+ 	global $l10n, $locale;
+ 
+ 	$mofile = ABSPATH . "wp-includes/languages/$locale.mo";
+ 	
+ 	load_textdomain('default', $mofile);
+ }
+ 
  function load_plugin_textdomain($domain) {
  	global $locale;
***************
*** 91,94 ****
--- 89,95 ----
  }
  
+ // Load the default domain.
+ load_default_textdomain();
+ 
  require($curpath . 'locale.php');
  ?>

Index: gettext.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/gettext.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gettext.php	11 Oct 2004 18:45:14 -0000	1.2
--- gettext.php	19 Oct 2004 00:18:12 -0000	1.3
***************
*** 116,119 ****
--- 116,122 ----
      $length = $meta[0];
      $offset = $meta[1];
+ 		if (! $length) {
+ 			return '';
+ 		}
      $this->STREAM->seekto($offset);
      $data = $this->STREAM->read($length);




More information about the cvs mailing list