- In order to add a plural form, open your.po file into Poedit, and from the Catalog menu select Properties Then, under the Translation Properties tab, next to the Plural Forms label, enter your plural form. Alternatively, you can open your.po file using a text editor. You will see on top, quite a few lines that are enclosed with double quotes.
- Poedit was built to handle translation using gettext (PO), which is used by many PHP projects (Drupal, WordPress), Python projects (Django), or virtually anything running on Linux.
How to use POEdit (free version) to create the.po/.mo translation files for your WordPress plugin The free version of POEdit doesn’t have the “Translate WordPress theme or plugin” functionality, but you can still generate the.po/.mo files used to translate your plugin with these instructions. Instead of using poedit to generate your translation strings from your code, use the WordPress i18n tools to generate a POT file for you. This has the advantages of a) not needing you to do anything special in poedit and b) getting everything that is possible for translation, including headers and non-standard translation string calls (not everything is and e).
I was there, too, struggling to make a proper settings in my PoEdit program and prepare all the strings for WordPress translation.
But there is always some quirks there that made me go Oooh. Tried everything, premium plugins and stuff, those plugins are good, but when you’re on a deadline, you always mix languages in translation strings.
Anyway, first thing to know is that you always develop in English first. That is the way to go, and that way you will not have problems with mixed languages later.
Don’t be tempted to add those Chinese that your client gave you in your translate string. You will regret it later.
I will not talk much and will give you a link where everything is explained. This guy deserves it. Thanks to Luka Peharda for the link to this awesome resource.
So, go to WordPress translation secrets and enjoy. This guy has it all, and what is the most important, that I could not find anywhere, is the configuration for the PoEdit to suck in all those WordPress translation functions easily.
Poedit needs to know what functions it must look for and get information from. In reality, gettext knows by itself what to look for in a .php file, but since WordPress uses its own wrapper functions to make our lives easier, this knowledge is no longer applicable.
In a few words, you should add this stuff to your PoEdit preferences to make it dance with WordPress translation:
After you have this, no string will ever escape from PoEdit (if properly put in translate function, of course).
Again, many thanks to Anastis Sourgoutsidis who made my life easier.
Poedit Wordpress Traduccion
The free version of POEdit doesn’t have the “Translate WordPress theme or plugin” functionality, but you can still generate the .po/.mo files used to translate your plugin with these instructions:
Poedit Wordpress
- Download POEdit
- Run POEdit, then go to File > New…
- Select the language of your translation strings in the plugin
- Go to File > Save and save the file somewhere (recommended to put it in the languages folder inside your plugin)
- Click “Extract From Sources”
- Click the small “+” button under “Paths” (bottom left corner) and select the main folder of your plugin
- Click the “Sources Keywords” tab along the top
- Click the small add button (second from the left)
- Enter __ (that’s two underscores) then press enter
- Click on the small add button again, then enter _e (underscore then e) and press enter
- Repeat to add any additional functions you might have used to translate in your plugin, such as esc_html__ (with two underscores at the end)
- Click OK
- Verify all your strings were found, otherwise go to Catalog > Properties… in the menu and add any additional translation functions (like esc_attr__) in the Sources Keywords tab
- Go to File > Save to save your .mo file again
Include the .po and .mo files in your plugin’s languages/ folder or make it available for download somewhere. You can also use something like GlotPress to provide a system similar to the translate functionality on wordpress.org.