Here's my thing:

I'm using a plugin that has multilang capabilities. The point is that the language translation in my country lang is very bad and it makes more complex than simpler my work. :D. So is there a way to force a plugin to not to use multilanguage and be showed, at least, in English?

2 Answers 2


What's the plugin? Is it using custom translations in mo/po files? Is there an admin interface which allows you to set the plugin locale?

There is a generic filter which you might be able to add to the plugin code to set the language which might look something like the following (obviously set the language to what you want:

add_filter('locale', 'wpse_get_locale');

// returns the locale based on user preference
function wpse_get_locale($locale) {
// get_current_user_id uses wp_get_current_user which may not be available the first time(s) get_locale is called
    if (function_exists('wp_get_current_user'))
        $loc = get_user_meta(get_current_user_id(), 'user_lang', 'true');
    return isset($loc) && $loc ? $loc : $locale;

However I wonder if it might not be easier to improve the translation of the plugin by editing the mo/po files or whatever they use for the string translation?

  • The plugin is Role Scoper and it has a myriad of options i can't understand the effect of. So i need, at least at the beginning, to understand what the functions are doing and then providing some translating corrections...
    – rdbisme
    Commented Sep 30, 2012 at 1:36
// to force use English, this filter value must return true.
add_filter('override_load_textdomain', 'myPlugin_OverrideLoadTextDomain', 10, 3);

add_filter('plugin_locale', 'myPlugin_forceUseLanguageForCertainPlugin', 10, 2);

function myPlugin_OverrideLoadTextDomain($override, $domain, $mofile) 
    if ($domain === 'woocommerce') // change text domain from woocommerce to what you want.
        $override = true;

    return $override;

function myPlugin_forceUseLanguageForCertainPlugin($locale, $domain) 
    if ($domain === 'woocommerce') // change text domain from woocommerce to what you want.
        $locale = 'en_US';// change your locale here to whatever you want.

    return $locale;

It required 2 filter hooks to work.

  • it does not matter what locale I put in the variable, using theese filters turn my plugin always to English
    – bluantinoo
    Commented May 12, 2023 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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