Before we can create translation files for our own plugins, their code needs to be specifically written to allow text items to be translated. This work starts in the plugin's activation routine, where default plugin option values are set, to find alternate values when a language other than English is specified in the website's configuration file.
This recipe shows how to assign a translated string to a plugin's default options array on initialization.
You should have already followed the Changing the WordPress language configuration recipe to have a specified translation language for the website.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
- Navigate to the directory and create a text file called
- Open the new file in a code editor and add an appropriate header at the top of the plugin file, naming the plugin
Chapter 11 ...