By

How To Translate Your WordPress Theme Into Any Language

Want to find out how easy it is to translate your WordPress theme into any language? Then read on…

Many WordPress themes can be translated, including our themes. They must contain the correct files, consult the theme author if you are unsure. The master theme translation file is a POT file, which can be found in the theme languages folder.

The program we will be using to translate the theme is Poedit, which is available for all major operating systems including Windows, OS X, and Linux.

If you haven’t already done so, install Poedit now. Then open it up, and select ‘File -> New catalog from POT file…’ from the menu.

Navigate to your themes languages folder and open the POT file. Next, you will see the ‘Catalog properties’ dialog box appear. You don’t need to change any of these settings so just go ahead and click OK to close the dialog box.

You will now be prompted to choose the location and filename for your .po translation file, which is used to store all your theme translations. Make sure you choose to save the .po file in the same directory as the theme POT file.

The default filename will be something like default.po. This is OK for now but you will need to change this later on to be more specific so WordPress knows which file to use for language translation. More on this later.

For now just go ahead and click Save to close the ‘Save as…’ dialog box. You may also notice that a .mo file is saved along with the .po file. Make sure that these two files are kept together.

NOTE: If you save your .po file in the parent theme languages folder then that’s fine but you should be aware that it will be overwritten during a theme upgrade. Not to worry, you can easily protect against this by using a child theme and saving the .po file in the child theme languages folder (just create one if the folder doesn’t already exist).

All our themes support the .po file being located in the in the parent them languages folder OR the child theme languages folder. If a child theme is active then the child theme languages folder will be checked FIRST. If no language file (that matches the locale set in WP config) is found then it looks in the parent theme languages folder.

This means that you can use a custom translation file in a child theme and it won’t ever be overwritten during theme updates! :)

Now for the fun part. You can start to create theme translations for any phrase used in the theme into your own language! Simply click on a phrase from the list in the main window to get started.

TIP: In Poedit hit CTRL+F at any time to do a quick search for the phrase you want to translate.

Towards the bottom of the Poedit screen you will see two text boxes. The first one (Source Text) is a read-only box that shows the text of the phrase you just clicked on. The second one (Translation) is where you enter your translations.

As soon as you enter your translated text in the ‘Translation’ text box you will also see it appear in the main window to the right of the original text. Also, for convenience, every translated phrase in the main window has a star added to the very left to make it easy to spot phrases that have already been translated.

As mentioned earlier it is important that .po (and .mo) filenames match the desired locale as specified in wp-config.php (located in your WordPress root directory). The naming convention is language_COUNTRY.po.

Some examples of .po file names are:

en_US.po
en_UK.po
fr_FR.po

Open up your WordPress wp-config.php file and add the WPLANG PHP constant, if one doesn’t already exist, as follows:

define (‘WPLANG’, ‘en_UK’);

In this example I am using the English UK locale so this would require the .po and .mo files to be named as:

en_UK.po
en_UK.mo

The rule of thumb is that whatever your .po and .mo files are called, the WPLANG constant in wp-config.php should be exactly the same (not including the file extension).

If you want to learn more about how WordPress handles language translation then click on the following link:

http://codex.wordpress.org/Translating_WordPress

Ask any questions regarding theme language translation in the comments. And let us know how you get on translating our themes into your own language!

14 Responses to How To Translate Your WordPress Theme Into Any Language

  1. Emyr says:

    Poedit has been available for Mac OS X and Linux for a long time. See http://www.poedit.net/download.php#osx

  2. summ3r says:

    you can also use web-based http://poeditor.com when handling po files to localize your wordpress themes.

  3. Amazing wow, thank you for the helpfull information.

  4. Nannie says:

    Solid stuff here on presscoders.com, man. I actually like what you have accrued here, certainly like what
    you’re saying and the way through which you say it. You’ve taken the effort to make it simultaneously entertaining and intelligent.
    I cannot wait to know much more from you.
    A helpful blog indeed.

  5. Omar Muhamed says:

    I Can’t say anything except (Thank You who Posted this post)

    : )

  6. Anuj says:

    There are many plugins to change the language of the content of any WordPress blog so according to you which one will be better Poedit or those plugins.

  7. Surik says:

    Thank You!

  8. Thanks for this great plugin.

  9. iSelektor says:

    Amazing, thanks.
    Love this :)

  10. Ashkan says:

    Awesome tips , appreciate it … so useful
    But one thing … While translation there were some source texts with codes at the end ! shall we add those codes to the translation part as well or no need !?

  11. Nilgoon says:

    it helped me out! thank you for this great post!

  12. Luciferbui says:

    Hi,
    I’m translate into vietnamese for my website. I did make vi_VN.po and auto have vi_VN.mo .
    Upload to my hosting
    On wp-config.php, change define (‘WPLANG’, ‘vi_VN’);
    but my theme is not translated yet. I don’t know why?
    Could you help me?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>