Translating text strings using Poedit
After inserting all the necessary code to look up translations for text elements, we need to create the actual translation files. While there are multiple tools available to perform this task, we will focus our efforts around the most popular one, the free multiplatform Poedit.
This recipe shows how to extract all the strings to be translated from the plugin's code using Poedit, translate them, and save the resulting language file under the plugin directory.
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 (Chapter 11/ch11-hello-world/ch11-hello-world-v3.php
) for that recipe from the code bundle. You should rename the file to ch11-hello-world.php
before starting.
How to do it...
- Navigate to the
ch11-hello-world
folder of the WordPress plugin directory of your development installation. - Create a new subdirectory named
languages...