[wp-hackers] What do you name the localization .mo when the locale is not set?

Wordpress Developer wordpress.development at gmail.com
Thu Jun 17 15:02:09 UTC 2010


I'm working on a localized template and have my .mo working fine for default
installs of WP. Love it: Just use _e('whatever', 'textdomain') and it echos
out the value based on the "whatever" key.

Unfortunately, my code fails after taking it from my personal dev
environment into a professional one. I've troubleshooted what I can and
think it's because the locale is not set on the new dev environment. I ran
this code to check:

<?php
$locale = get_locale();
if($locale == "en_US") {
   echo "english: $locale";
} else { echo "not english: $locale"; } ?>

In the working dev environment, it echos out "english: en_US"

In the non-working dev environment, it echos out "not english: "

In both installs the WP_Lang constant is not set (wp-config: "define
('WPLANG', '');"). It's a bit confusing to me as to why one install defaults
to en_US (as I might expect) but the other doesn't seem to have the locale
set at all. In any case, I suspect my .mo is failing because it's named
en_US.mo in the theme folder and since the locale on the second setup is not
en_US it's not finding it.

In any case, I figure my .mo has a chance if I name it the right thing for a
WP install with no language set. Is there such a namespace? What do you name
the localization .mo when the locale doesn't seem to be set?

Thank you!


More information about the wp-hackers mailing list