I’m trying to localize my plugin. I have two .mo
files:
/lang/myplugin-es_ES.mo
/lang/myplugin-en_US.mo
The translation works but I don’t understand how to change the language to use the en_US
file instead of the es_ES
. This is what I’m trying:
function define_locale($locale) {
$subdomain = array_shift(explode(".",$_SERVER['HTTP_HOST']));
if($subdomain == "en")
return 'en_US';
else
return $locale;
}
// Define Locale
add_filter('locale','define_locale',10);
While get_locale()
shows the locale is en_US
my plugin still uses the es_ES
file. What am I doing wrong?
Have you tried to add/change language flag in
wp-config.php
fileREF: Installing WordPress in Your Language