During the process of creating my first public WordPress theme one thing was very important to me – I wanted the theme to be useful to as many people as possible. To reach this goal, I knew that I would need to make sure that my theme could be used in any language. Luckily, WordPress core provides a few different functions that makes this pretty easy to do. If this is a new topic for you, please read more about Internationalization for WordPress Developers in the codex.
By using functions like
_n() we can easily allow all of the text in our themes to be translated into other languages. Outside of doing a line-by-line review, it’s rather difficult to tell if you’ve internationalized all of the strings in your theme. I always wanted a way to make this easier to determine and today I discovered a neat way of doing so!
Pig Latin is a plugin by Nikolay Bachiyski which makes it easier to see which strings are ready for translation and it does so in a really fun way. It will scan all internationalized strings and convert them into pig latin! Once you have this plugin installed you can easily click through public-facing template files as well as admin screens to see which strings are able to be translated and which ones are not.
Here you can see that all of the link text in the admin menu has been converted to pig latin. This is because WordPress core has prepared them for translation. If we are testing a theme with the Pig Latin plugin we might come across something like the following:
Here, our theme has created a custom Theme Options screen but the Pig Latin plugin did not convert the text in the admin menu. This is because our theme has not prepared this string for translation. Basically if strings are not converted to pig latin it’s an indication that you should prepare the string to be translated.
The Pig Latin plugin is quick, easy and fun way to test your theme for internationalization. Try it out today!
One thought on “Better WordPress Theme Internationalization with Pig Latin!”
This is brilliant! ere’sThay alwaysay oomra orfa igPay atinLa!
Comments are closed.