Create wordpress language file with poedit

Giving users the ability to translate your plugin is important. So you should be using __, _e, _x …etc in your plugins as myuch as possible.

In your plugin folder, create a lang sub-foldder to store your language files. In your init plugin file, make sure you have the localisation code:

$domain = 'your-plugin-name';
$locale = apply_filters('plugin_locale', get_locale(), $domain);
// let user customise the lang in a dfferent folder.
load_textdomain($domain, WP_LANG_DIR.'/my-plugin/'.$domain.'-'.$locale.'.mo');
// load plugin locale
load_plugin_textdomain( 'your-plugin-name', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );

next download poedit from

1) Open poedit and fill in the project info.
2) Under the paths tab, fill in the base path, eg /home/username/your-wordpress-project/wp-content/plugins/plugin-name/. Then add a “.” under the Paths input box below.
3) Under the keywords tab, add “__” and “_e”
4) Click ok and when prompted to save the file, save it in your plugin lang folder in the form of your-plugin-name_lang_locale format, eg your-plugin-name_en_AU

You should get 2 files of with the .mo and .po extension.

good luck.

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.