[wp-hackers] Translation/language issue in latest dev build

Jennifer Hodgdon yahgrp at poplarware.com
Tue Jan 16 19:47:52 GMT 2007


I wrote:

>> So I am wondering, has something major changed in how gettext or
>> translations are done, between 2.0.6 and the current dev version of
>> WordPress?  Meanwhile, I'll keep poking around...

Aha! It turns out it was a change in wp-settings.php, version 4202, 
checked in on 21 Sept 2006. These two lines were added (I think 
something similar, but not quite the same, was removed from a 
different file at the same time):

if ( defined('WPLANG') && '' != constant('WPLANG') ) {
	include_once(ABSPATH . WPINC . '/streams.php');
	include_once(ABSPATH . WPINC . '/gettext.php');
}

Here's the sequence of events.

a) My config file has WPLANG set to '' (default language for blog is 
English).

b) The Polyglot plugin (when it eventually is loaded) checks to see if 
someone has requested a different language, and sets WPLANG to that 
language then. For example, if someone has requested Spanish, WPLANG 
gets set to 'es'. Polyglot also causes gettext to read in the es.mo 
file at that time, and sets up translation.

c) Prior to the 21 sept check-in, this worked fine. Either gettext was 
loaded no matter what, or the loading took place after Polyglot had 
set WPLANG correctly. I have not investigated to figure out which is 
the case.

d) With the current version of wp-settings.php, however, when 
wp-settings is loaded, WPLANG is still '', and gettext.php is not 
loaded. Therefore, when the plugin asks gettext to read the es.mo 
file, WordPress dies and the user sees a blank page.

e) Work-around: I set WPLANG to 'en' in my config file, and everything 
is fine. wp-settings thinks a language is needed, gettext.php is 
loaded, and then Polyglot does the right thing with translation.

So... should I file a bug on this? Is there a reason that gettext 
should not be loaded for everyone?  Or is it a feature?

     --Jennifer


More information about the wp-hackers mailing list