1

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?

0

Have you tried to add/change language flag in wp-config.php file

define ('WPLANG', 'en_GB');

REF: Installing WordPress in Your Language

  • I added a function and changed it in the wp-config based on the current url – Lisandro Vaccaro Apr 3 '14 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.