WordPress Plugin: Localization


This is quick steps on how to create your own Language file for wordpress plugin. I hope you know that you can call wordpress localization functions as

echo __('text your want to display', 'your-unique-language-textdomain'); 

This localization is done using internal function of wordpress, where it load language file for given language wordpress is set, and then loading relevant language files for translation  Since you are making your own plugin you need to create your own language file. So to do that simply do this:

1. Download POEdit software from : http://sourceforge.net/projects/poedit

2. Now create a new catalogue and define the Source Path as your plugin folder.

3. Define keywords as “__” double underscore and “_e” .

4. Once done click “Update” or “parse code” to prepare dictionary of text.

5. Simply select text and edit it in your language.

6. Now save the file in a folder within your plugin folder with any name just add dash followed by Language code as you define in “WPLANG” i.e. -hi-IN for Hindi-India. 

7. Add or call following if you have your language file in “lang” folder or change path as per your language file path.

load_plugin_textdomain('your-unique-language-textdomain', false, basename( dirname( __FILE__ ) ) . '/lang');

8. Enjoy