By default all Templatic themes are in English. If you need them in your own language you’ll have to translate them. Translation is accomplished by manipulating PO and MO files. PO files are used for the actual translation while MO files are essentially machine files containing the translations displayed by WordPress. To edit PO files and generate MO files you will need Poedit, a free piece of software available for both Windows and OS X. Details on using Poedit will be available later in the guide.

Directory theme owner?

In our Directory Resources there are several completely translated PO files available for the Directory theme. Click here to see which languages are available.

Translating the theme into 1 language (making small changes)


If you want to translate your site into just one language you don’t have to generate any new files, the existing English PO and MO files will work fine. The instructions below are also applicable for small text changes. You don’t have to translate the whole file if you don’t want to.

  1. To get started connect to your server and locate the English PO file (en_US.po). It will be located either in the theme root or in a folder called “localization”, “languages”, “lang”, etc. Once you locate the file download it to your hard drive.
  2. Start translating the file. Here’s a quick image of the Poedit interface…
    poedit
  3. Once you finish translating it just hit the save button (CTRL/CMD + S). Poedit will create a en_US.mo file in the same folder where the PO you were editing was located. In case the MO wasn’t created go to File ⇨ Preferences ⇨ Editor (tab). Check the “Automatically compile .mo on save” option.
  4. Upload both your PO and MO files back to the server. Make sure to upload them in the same folder from where you got the PO file.

Changing Pre-Defined text in Directory theme using Poedit

Translating your site into another Language using Poedit

Aren’t seeing any changes?

For the majority of Templatic themes the above steps will work, however in some of them (mostly eCommerce themes) a small code tweak is necessary before your translations will start working. Do this…

  1. Connect to your server and open the theme’s functions.php file, it’s located inside the theme root folder.
  2. Locate the code that looks like this (doesn’t have to be identical) near the top of the file.
    //load_theme_textdomain('default');
    //load_textdomain( 'default', TEMPLATEPATH.'/localization/ar_AE.mo' );
  3. Uncomment those lines and change the locale to en_US, i.e. make it look like this
    load_theme_textdomain('default');
    load_textdomain( 'default', TEMPLATEPATH.'/localization/en_US.mo' );
  4. Please contact our Helpdesk if you continue having problems getting the translations to show.

 

Directory theme owner?

Directory is special because it contains both front-end and back-end translations files. It also comes with multiple sets of language files; one set for each component. For more details about translating Directory please click here.

Translating the theme into multiple languages


In order to translate the theme into multiple languages you will have to create new sets of PO and MO files; one set for each language. Please note that this won’t allow you to run multiple languages at the same time. Only you (the admin) will have the ability to change the language. If you’re looking to create a multilingual site where visitors can change the active language at any time I recommend checking out the WPML plugin instead. Be sure to check whether your theme is WPML compatible before buying the plugin.

  1. To get started connect to your server and locate the English PO file (en_US.po). It will be located either in the theme root or in a folder called “localization”, “languages”, “lang”, etc. Once you locate the file download it to your hard drive.
  2. Rename the en_US.po file so it reflects your own language. For Italian, it would be it_IT, German ⇨ de_DE, Portuguese (Brazil) ⇨ pt_BR, etc.
  3. Start translating this new file you just created. Here’s a quick image of the Poedit interface…
    poedit
  4. Once you finish translating it just hit the save button (CTRL/CMD + S). Poedit will create a MO file in the same folder where the PO you were editing was located. In case the MO wasn’t created go to File ⇨ Preferences ⇨ Editor (tab). Check the “Automatically compile .mo on save” option.
  5. Upload both your PO and MO files back to the server. Make sure to upload them in the same folder from where you got the en_US.po file.
  6. Now we need to tell the theme to use our new MO file instead of the default (en_US.mo) file. To do that open your theme’s functions.php file, it’s located inside the theme root folder.
  7. Locate the code that looks like this (doesn’t have to be identical) near the top of the file.
    //load_textdomain( 'default', TEMPLATEPATH.'/en_US.mo' );
  8. Uncomment that line and change the locale (it_IT is just an example), i.e. make it look like this
    load_textdomain( 'default', TEMPLATEPATH.'/it_IT.mo' );

 

Directory theme owner?

Directory is special because it doesn’t contain that line inside the functions.php file. The new MO file needs to be activated using a different method. For more details about this please click here.

Updating existing translations


The language files included with our themes can get updated over time. To avoid translating everything again Poedit has a useful feature that allows you to easily update / add new strings (for translating) to your existing PO language file.

  1. Download the latest version of your theme from the member area and locate the en_US.po file (should be inside the theme root or inside the lang/languages folder).
  2. Change the file extension from .po to .pot. If the theme already comes with a POT file you can skip this step.
  3. Open your current (translated) PO file with Poedit
  4. In Poedit, click on Catalog ⇨ Update from POT file and choose the POT file you just created.
  5. If you did everything correctly the new strings should now be available inside your file.

Getting fuzzy strings after updating the PO file?

It’s not uncommon for some strings to become fuzzy after updating the PO file. Fixing this is as simple as un-fuzzying those strings. To un-fuzzy a string click on the string and hit the “Fuzzy” button. Here’s a quick screenshot

ff412

Update existing .po file to add new strings

Follow the below mentioned steps to merge the two .po files in order to prevent your previous translations:

(1) All you have to do is please download the provided .Po file from the ticket and extract it in a path say ‘Desktop’.

(2) Open your site’s existing .po file located in path ‘\wp-content\themes\Directory\languages\‘ or ‘\wp-content\themes\childtheme\languages\.

(3) Click on Catalog tab on top left corner.

(4) Press ‘Update from POT file’.

(5) In the pop up window, browse the new .po file placed on Desktop.

(6) Save the changes.

The above steps will help you protect your site’s existing translations and also helps to add the additional missing strings.

After following the above steps, all the required strings will be translated from .po file of Directory Folder only.

All the best! 🙂