O'Reilly logo

WordPress Plugin Development Cookbook by Yannick Lefebvre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading a language file in the plugin initialization

The final step to plugin translation is to put the code in place to load a translation file. This is done by registering an action hook callback and calling a single function when it gets executed.

This recipe shows how to load the translation file created in the previous recipe.

Getting ready

You should have already followed the Making admin page code ready for translation and Translating text strings using Poedit recipes to have the proper files required for this recipe. Alternatively, you can get the resulting code for these recipes from the code bundle. You should rename the file ch10-hello-world\ch10-hello-world-v3.php to ch10-hello-world.php and copy the languages folder to the right location ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required