Modifying shortcode output for translation
As we have seen in numerous recipes, shortcodes are powerful tools that provide an easy way for users to add content to their website posts and pages. Since this content is presented to users, it can benefit from a translation just as much as the website's administration pages.
You should have already followed the Making admin page code ready 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-v2.php) for that recipe from the book's GitHub page and rename the file to
How to do it...
- Navigate to the
ch12-hello-worldfolder of the WordPress plugin directory of your development installation.
- Open the