Force Plugin to English Translation

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?

Leave a Comment