Localizing a WordPress plugin enables your plugin to reach widest possible audience. Fortunately, WordPress makes it rather simple for plugin authors (and theme authors) to ensure their work is available in many languages.
This post will go over the steps that are necessary from a plugin author’s end to make it easy for others to translate a plugin. For those then wishing to translate, I will go over a program called poEdit, which will allow you to translate the plugin for your use and for others.
The Benefits of Localizing a Plugin: The more languages your plugin is in, the more people that can download and understand it.
If a plugin is popular enough, you’ll have people volunteering to translate in order to adhere to a different part of the world. The hard way would be someone going through your code after each release and translating word for word. However, there is an easier and more portable way to translate: the .po file.
With the .po file, anybody can translate your plugin as long as they are familiar with the original language. And if you make any changes to the plugin’s source, a user doesn’t have to dig through your code to re-translate. The translations are preserved in the .po file and all the user has to do is update the .po file in their language.
Preparing a Plugin for Localization: WordPress makes use of GNU gettext for translations. WordPress has two functions that can be called by plugin authors: _e, and __. Every time you output text to the user, you should use one of the two functions.