Translate a WordPress Theme in 3 Easy Steps

translate wordpress

Lately, more and more people are asking us how to translate a WordPress theme into a language other than English. And with an estimated 2 billion people now online, it’s no wonder. Fortunately, it’s a fairly straightforward process, and I’ve boiled it down into 3 simple steps.

This tutorial assumes the WordPress theme to be translated has been localized using the the GNU gettext framework. In other words, the theme is ready to be translated. If your theme has not been localized, you’ll need to go through each theme file and convert all English language text into a gettext function. See here for a short description on how to do that.

1. Acquire or Create a POT File for Your WordPress Theme

POT stands for “Portable Object Template,” and a POT file (aka .po file) is basically a list of all the English-language text found within the files of a localized WordPress theme. You can find links to the POT files for Solostream’s premium wordpress themes in the Solostream support forum here (you’ll just need to login to the forum first).

If you’re using a theme other than a Solostream theme (gasp), check with the theme author to see if they offer a POT file. If they don’t, you can easily create your own POT file with a free program called POEdit (see Creating POT Files).

2. Translate the POT File and Upload to Your Theme Folder

Once you have the POT file, you’ll need to open it in a program like POEdit, and translate the English language into your preferred language. When complete, you’ll want to save the file twice, as two separate files – a .po file and a .mo file. When you save the files, you must name them according to your language code.

Find a list of language codes at WordPress in your Language. As an example, the language code for English is en_EN, so you would save the translated files as en_EN.po first, then en_EN.mo. When that’s done, simply upload the files to your theme folder.

3. Tell WordPress What Language to Use

If your theme does not already include it, you’ll need to add the following line to the very top of your functions.php file (just before the opening <?php tag):

<?php load_theme_textdomain('text_domain'); ?>

Notice “text_domain” above – it’s called the text domain name. You can use any name you want, but you should use the same name that’s used throughout the theme in the gettext function.

So, for example, if your gettext functions look something like this:
<?php _e("About the Author", "wp-inspired"); ?>

You’ll want to use “wp-inspired” in place of the text_domain above.

Finally, if you haven’t done so already, you’ll need to make sure your wp-config.php file matches your language files. For example, if you’re using a French translation, you’ll need to add the fr_FR.po and fr_FR.mo files to your theme folder, then set your language in wp-config.php, like this:

define ('WPLANG', 'fr_FR');

By the way, your wp-config.php file is located in the main directory where all your core WordPress files are located.

Save your wp-config.php file, upload it to your WordPress installation, and you are ready to go.

Other Helpful Links

About the Author (Author Profile)

Hi I’m Michael, a business coach and a creative entrepreneur. I inspire and empower people to make a difference in the world while they create an amazing life for themselves and those they love.

Comments (32)

Trackback URL | Comments RSS Feed

  1. wathmal says:

    thanks very much,,!! it works like a charm!! :) )))

  2. pdjkth says:

    It worked for me on my site. Thanks.

  3. summ3r says:

    hi! if you’re interested in a reliable, user friendly, collaborative tool to localize software, websites or mobile apps, i warmly recommend this web-based software localization tool http://poeditor.com/

  4. Patrik says:

    Thank you so much for this tip! It helped me to translate my themes into Norwegian.

  5. hussain says:

    Thank you so much. It is very useful. I just got chance to implement it and work like charm :D

  6. Thanks for all the tips! I finally got it to work! Hopefully my profile will show up together with my posts soon :D :D

    (if this happens I will have to change my profile pic lol)

  7. Krisjanis says:

    Hello! Thanks for this tutorial. This really helped me because I was searching this for really long time.

    Greeting :)

  8. jonius says:

    I followed all steps but no luck. I found it why, the .mo file wasnt created by poedit, you must go to options and click on compile .mo file. If you save as .mo straightforward it will not work

  9. Agnieszka says:

    Isn’t there a way to change the wp-config by placing a function into functions.php in the theme root.

    I was looking at distributing a theme and don’t wish to say to everyone that they must go edit wp-config

  10. JXL says:

    THANK YOU!!! I know this is an old post but that doesn’t matter. I’ve searched all over the internet to find a SIMPLE yet clear solution to translating a theme and yours is by far the BEST set of instructions.

  11. Nasir Rashid says:

    Thanks Michael i was looking something like this. You make my Life easy :) . Well Done :)

  12. ion says:

    I am trying to translate the method viva themes theme, and i translated the appearing code text to spanish, the problem is that it is not loading the .po file i put for another languaje. everything is working fine(multilang) but this theme. I asked for help in the company and they told me they dont suport multilanguaje for this theme. I am getting crazy, they told me i needed to localize the theme(on my own of course). I put all the coding text i needed __() and _e(), but the .po file is not loading. I created a new po file with a single word in it and tryed loading it (“read more” word), and it isnt working. What do you recommend me?

  13. Hi:

    I bough a theme and i am translating it. I think it is ready, but i don’t see the translation working. i have changed my wlang in config.php, i have this line on functions.php:

    And uploaded the es_ES.mo and .po files to a folder i created within the theme folder called languages.

    am i missing something?

    Thank you

  14. TamaraAw says:

    gooosh where do you install the 2 files after you done traslating?

    Will it still work if i translate just few texts, or do i have do them all?
    thanks

  15. Idris says:

    this is really useful tutorial…thank you for sharing!!!

  16. Felipe Veiga says:

    Amazing tips, thanks a lot.
    POedit has saved me so much of my time, thanks for sharing!

  17. ofe says:

    Hi Michael,
    will your process work for a Hebrew translation?
    Ofek

  18. Dich thuat says:

    thanks everybody. its useful for me.

  19. bassoprofondo says:

    idea / suggestion:

    Codestyling Localization WordPress Plugin

    “You can manage and edit all gettext translation files (*.po/*.mo) directly out of WordPress Admin Center without any need of an external editor. …”

    https://wordpress.org/extend/plugins/codestyling-localization/

  20. abubakar says:

    Many Many Thanks Brother Michael,

    I had few projects of wordpress themes in Danish language but every time I had to translate the themes manually, I have gone through some articles but none of them helped me, infact none of them was something like complete tutorial.

    But finally I am able to do things in a professional way and that’s because of you.

    Thank a lot brother

  21. aukse says:

    Thank you so much for mentioning text_domain issue – I have looked through many Google serps on translating WP theme, but none of them had this advice – and that was exactly what I needed to fix in the theme I am using…

    If someone also uses OrganicThemes template, text_domain is the issue. Although creators state that is is enough to make .po and .mo and that’s it…

  22. Iskwew says:

    This was very helpful. You have to go through many small steps to get this right, and if you miss one, nothing works.

    Using this enabled me to localise WP-inspired very easy. Having translated a lot of themes the hard, manual way, it is such a relief to do it the easy way.

    Thanks!

  23. Paul says:

    Hi! Nice to see a question I’ve asked recently, answered in a separate post :) Very well done.

    And I’m happy to hear that the themes you create are using gettext. It will be really easy to translate them, as you outlined in this post.

Leave a Reply

No Theme Support Questions Please

We will not respond to theme support questions submitted via this form.. If you've purchased one of our themes or a Premium Themes Membership, please visit the Solostream Support Forum for support questions. To do so, login to the Solostream Member's Area, and click the link for the Solostream Support Forum.

Site Meter