how to load the language file in plugin?

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 );

Related posts

Leave a Reply

2 comments

  1. 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.