Translating text strings using Poedit
After inserting all the necessary code to look up translations for text elements in our plugin code, the next step is to create the actual translation files. While there are multiple tools available to perform this task, we will focus our efforts on the most popular one, the free multi-platform Poedit.
Getting ready
You should have already followed the Modifying shortcode output for translation recipe to have a starting point for this recipe. Alternatively, you can get the resulting code (ch12/ch12-hello-world/ch12-hello-world-v3.php
) for that recipe from the book's GitHub page and rename the file to ch12-hello-world.php
.
How to do it...
Follow these steps to extract all the strings to be translated from the plugin's code using Poedit, translate them, and save the resulting language files under the plugin directory:
- Navigate to the
ch12-hello-world
folder of the WordPress plugin directory of your development installation...