If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)


Featured templates

WordPress. Template localization

This tutorial shows how to create a multilingual Word Press template and how to change WordPress theme language.

Define language files root

First of all we need to load the textdomain. In other words we need to define the directory with the language files.

In your WordPress installation directory go to the folder "/wp-content/themes/your_theme/" and open "functions.php" file.

Add new function:

	load_theme_textdomain( 'theme_name', TEMPLATEPATH . '/languages' );


  • theme_name – the name of the directory with your theme files (wp-content/theme_name);
  • TEMPLATEPATH – root to the template files. Global variable, no need to change it.
  • /languages – name of the directory with the language files. It is located in your theme folder.

Using language variables

If you want to insert some text content directly into your theme files please use the following rules

Do NOT use construction as follows:

<?php echo 'your_text'; ?>

for text content.

To add multilingual content into your template files please use the following construction:

<?php _ e('your_text', 'theme_name'); ?>

You can also use the following one

<?php echo '<h2>' . __('your_text', 'theme_name') . '</h2>'; ?>

Please pay attention to the parameter ‘theme_name’ in the language strings. It is the same parameter that has been used in the ‘load_theme_textdomain’ function

Creating language files

Now we need to create the language .MO and .PO files.

The easiest way to create these files is the PoEdit application. It can be downloaded from the official website at www.poedit.net

Download the PoEdit application and open it. From the top menu click File > New Catalog

  1. At the ‘Project’ tab input your project details
  2. At the ‘Path’ tab input ./ into the the ‘Base path’

  3. At the ‘Keywords’ tab add new keywords ‘__’ and ‘_e’

Click OK. PoEdit will automatically scan files in your theme directory, and list all strings. Your work now is just translate them. After that, save file in format language.po (ie. pt_BR.po, de_DE.po, etc.) in the /lang/ directory.

Set Default WordPress language

There are two ways of setting default language for your WordPress installation.

1. The first way of settings the default WordPress language is download the localized version

2. Open wp-config.php file from the WordPress installation root and define the language:

define ('WPLANG', 'en_US');

How to change theme localization

1. Open WordPress installation directory

2. Go to ‘wp-content/themes/your_theme/languages’ folder

3. Rename the existing files to the localization name listed in wp-config.php file.

For example if your wp-config.php file contains define (‘WPLANG’, ‘en_US’); language definition. Your language files should be called en_US.mo and en_US.po

4. Open the language files with PoEdit application

5. Select the line you want to edit and in the bottom area input the line translation

The language files can also be modified using the code editor like Notepad++ or Adobe Dreamweaver.

For example you opened the .mo file with notepad++, you can see the following:

#: ../archive.php:8
  #, php-format
  msgid "Monthly Archives: <span>%s</span>"
  msgstr ""

To change the string translation type the translation value inside the msgstr quotes

Save the file and refresh browser page to see your changes.

Thank you for your attention. In case of any issues with our template feel free to contact our team using the online help desk at http://esupport.template-help.com/index.php?_m=tickets&_a=submit

  • Hello

    Nice, man! thanks

    No votes yet.
    Please wait...
Live Chat
We help you to choose the right product.
Start chat