Theme Localization

Wodpress theme localization seemed like an easy task.  And while all the info was there, I ran into several hiccups.


This piece of open source software seems like a great tool for localization until it doesn’t work.  For me, it didn’t read the source files correctly.  If the _ or _e functions were not at the start of a line it did not pick it up.  So my results were always empty until I moved one of the functions to the start of the line.

PoEdit doesn’t allow  you to edit.  Normally this is fine, but not good if the source files aren’t read correctly.


iCanLocalize PHP Text Scanner

This tool saved the day for me, but not without problems of it’s own.  The scanner apparently looks for the closing PHP tag “?>”.  In one of my files I had no closing tag so it didn’t work for me.  In another file I had it did have the closing tag, but it wasn’t at the end of the file so not all translations were picked up.

In the end I just edited my PHP file to not have the closing PHP tags or if there were a lot, I just edited the po file manually.  After having that set I opened up PoEdit and created the .mo binary.  What a pain.


WordPress documentation

The docs say to use  This is not true.  In your theme, just use



On the up side, after doing a ton of searching for my problems I found out about qTranslate.  It is a great WordPress plugin to make translating your website very easy.  It has a textbox/editor for each language when you are editing your post so you can easily understand what’s going on.  It also provides some decent API to use in your themes.

UPDATE:  qTranslate doesn’t really work “out-of-the-box” when using with WooCommerce.  so instead I used WPML.


WPML is a bit different from qTranslate.  Instead of translating your content inside each post, you translate it all on one page.   It’s pretty good in that  you can retrieve strings from plugins and themes and add localizations right inside of WordPress.  No need to handle .po files and go through the troubles i did.   WPML lets you translate the attributes of products and all strings throughout the checkout (and everything else).


Tagged with: ,

Leave a Reply

Your email address will not be published. Required fields are marked *