0

I'm changing the locale using the locale filter. I've tried various methods; creating a plugin and hooking into filter, declaring locale filter hook in the functions.php file, and even as simply as defining my WPLANG constant; in all cases, only my theme .mo file is translated, not any of the plugins.

My custom theme .mo file loads the correct translations but not the plugins. I'm wondering why the plugins are not showing the appropriate .mo translations when locale is changed?

Here is what I have:

<?php
/**
* Plugin Name: WM10 Locale Change
* Description: A custom function to change locale.
**/

function wm10_change_locale($locale = '') {
    return "fr_FR";
}

add_filter('locale', 'wm10_change_locale', 10);
?>

How can I have the plugins recognize the locale change and serve up the appropriate .mo translation file? Should it not be as simple as setting the WPLANG constant? I've tried everything and I can't get the plugins to output .mo translations in my specified language.

The .mo files are there, I've tried even adding them to the /wp-content/languages/plugins/ directory named appropriated {PLUGIN_NAME}-{LANGUAGE_CODE}.mo but still no luck.

  • Try the Debug Translations plugin. It can tell you where translation files are searched for. – fuxia Mar 19 '15 at 13:09
  • Please use only one account, and if you have found a solution, write it as an answer, not as an edit to the question. – fuxia Mar 19 '15 at 13:46
0

Thanks @toscho — The problem plugin in particular is wp-pagenavi. The backend strings are being translated, however; the frontend remains in default en_US locale. I found this: https://wordpress.org/support/topic/translation-91

To be more specific, the text field values on plugin options page do not get translated so my assumption is that translations are malformed somewhere in the codebase.

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.