Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 );
share|improve this question

2 Answers 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

share|improve this answer
    
Yes I did everything –  coderex Sep 14 '10 at 9:37
    
hmmm... what is your .mo file named exactly? –  Rarst Sep 14 '10 at 10:54
    
tboy_displayTimeZone.de_De.mo and tboy_displayTimeZone-de_De.mo I tried both.. :( –  coderex Sep 14 '10 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 '10 at 11:30

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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