1

I'm unable to load the plugin's locale file (.mo). I did all the procedues described in the http://codex.wordpress.org/Writing_a_Plugin but its not working. If I the lang string to the wordpress default wp-content/language/de_De.mo file then its show the correct translated string. but not loading the data from my plugin folder :(

EDIT:

$plugin_dir = basename(dirname(__FILE__)) ."/lang/";
load_plugin_textdomain( 'tboy_displayTimeZone', null, $plugin_dir );

2 Answers 2

2

"All procedures" is not very descriptive. :)

Are you calling load_plugin_textdomain() function? Had you set domain in your plugin's strings?

There is also relevant section here: I18n for theme and plugin developers

4
  • Yes I did everything
    – coderex
    Sep 14, 2010 at 9:37
  • hmmm... what is your .mo file named exactly?
    – Rarst
    Sep 14, 2010 at 10:54
  • tboy_displayTimeZone.de_De.mo and tboy_displayTimeZone-de_De.mo I tried both.. :(
    – coderex
    Sep 14, 2010 at 11:22
  • What does load_textdomain( $domain, $mofile ) returns with your values for domain and path to .mo file? Boolean true/false.
    – Rarst
    Sep 14, 2010 at 11:30
0

You have to check if the plugin's unique name is described in the translation keywords terms. For example in this code:

echo = __('Word', 'your-plugin-unique-name');

The unique name is "your-plugin-unique-name". You should add this on load function:

load_plugin_textdomain( 'your-plugin-unique-name', null, $plugin_dir );

And also has it in your .MO file's name: 'your-plugin-unique-name-de_DE.mo'

It will work.

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.