Internationalization and Localization of WordPress Theme : Part 2

The Part 1 for this post was written on October 11, 2012 that is like more than a year ago. I should have written the second part way earlier but guess I got lazy and lost in my own world. No harm done! here I am now writing the Part 2 for this article, hope this will be helpful to some of you guys out there.

Lets get a short review about the Part 1. In Part 1, I talked about what actually is internationalization and localization and how to make the WordPress theme translation ready. It was basically targeted towards the WordPress theme developer and included about how to make the strings present within the theme translation ready with the WordPress translation functions. Don’t get a thing what I am talking a about?, perhaps you should visit my first article Internationalization and Localization of WordPress Theme : Part I and come back.

Now, in this second article I will talk about how to extract these translation ready strings with appropriate software, provide a translation for each string, create a language file for a different language and instruct WordPress to enable localization and to load the language file. This article will be useful for both the developers and users. For users it will be useful as it will not have any coding involved. Thus, they can follow this article, create a language file for the theme (this theme needs to be translation ready) that they are using and use it.

Okay then lets start now. At this point you should have a WordPress theme in your hand that is translation ready. The other thing that you need to grab is a translation tool for WordPress. Here are some that I have listed in the lines below:

My personal favorite is Poedit tool so I will use this to create the language files. You can download it from the above link. Install this tool in your computer, open the Poedit tool, create a new catalog then follow the instruction below and it should be easy.

Note: Usually if a theme is translation ready, there is a POT file already inside the theme as most of the theme authors have already created it and kept it there for you. So, if it is there then you don’t need to create it and you can skip the following POT file creation part.

In Project Info tab:

Fill in the project’s information in the “Project info” tab. You can view the below picture to see the example content to be filled up.

In “Paths” tab:

Usually the language files are kept inside the language folder (you can name the folder anything you like) of the theme folder. So, you can set the base path as shown in the picture below to search for translation strings inside the theme folder. You can set this paths according to your language folder where you keep the language files.

In “Keywords” tab:

Add all the WordPress translation functions that are used in the theme as shown below and click on ‘OK’ button.
Save the file and there you go you have created the POT file.

Creating the language file for your own language

Open the pot file, write the translation for the strings in your own language. The following picture will show you on how it’s done.
After you are done with this. Save the file as .po file by clicking on ‘Save as’ button of the ‘File’ menu. This will create the language files.
It is a better approach to name the .mo and .po files standardly, like and pt_BR.po as shown in the figure. To find our the standard code name for your own language you can see it here WordPress in Your Language. That’s it about creating the language files, keep it in the same language folder as the pot file.

Hmm. I have created the language file now how should I use it?

This may be the only question that you may have once you have got this far. Don’t be afraid it’s very easy. Open the wp-config.php file inside your WordPress install. Find the following bit of code line

define('WPLANG', '' );

and replace it with

define('WPLANG', 'pt_BR' );

Save and upload this file.

That’s it to having your WordPress site in you own language. If you have any questions you can fire them in the comments below and I will get back to you.

8 thoughts on “Internationalization and Localization of WordPress Theme : Part 2

  • June 2, 2014 at 6:00 pm

    hi, I’v a question. Im using the nice spacious theme. I change the pot in a nl_NL.po. And it is working on some places like the search box. But not all the widgets did change. The TG;services is working ‘read more’ is now dutch but the TG; single page is still ‘read more’. What can i do? Thanks

    • November 7, 2014 at 3:31 am

      Firstly, sorry for the late reply. We have nl_NL language file now already included within the theme file. So, I guess this issue now solved. Thanks.

  • August 14, 2014 at 2:31 pm

    Just started with the a Danish translation of Accelerate, and have payed for the PoEdit, which means you can just point to you theme, and PoEdit do the rest, just remember to chose the right language…

    • November 7, 2014 at 3:29 am


      If you like you can send us the Danish language file you can send it to and we will include inside the theme folder in our version update. This will help others as well. 🙂

  • October 7, 2014 at 11:20 am

    Hello sanjip.shah!

    Thank you for your great articles and for creating such a good free themes such as Spacious. I was following your guides for translating the Spacious theme and did everything as it should be done however nothing was translated in my own language after I’ve added the following line into my wp-config.php file “define(‘WPLANG’, ‘bg_BG’); . I have created the bg_BG.po and files and uploaded them to the themes language folder. I have also created a languages folder in the wp-content folder in my wordpress installation and trow there the wordpress translation files and nothing happens. I have tried to clear browser cache and cookies and log off and log on again in wordpress dashboard with no luck again. Could you please point me to the right direction if I am doing something wrong?

    Best Regards!

    • November 6, 2014 at 9:20 am

      Hi Stoil,

      Firstly, thanks for you appreciation and also sorry for the late reply.

      About your question if you using the WordPress version 4.X, there has be some changes in this.
      So, after you define the WPLANG in wp-config and add the languages files into Theme’s language folder you will need to do one more thing. In the dashboard, go to Settings->General, scroll down a little bit and choose your language from the ‘Site Language’ drop down option. Save the changes.
      Hope this helps.

  • April 29, 2015 at 7:15 pm

    First, thanks for the post. It helped me to translate hueman theme.
    Secondly, I advise you to check your website’s font Fira Sans – in Firefox i dont see some letters (S, F, I, ..), whereas in Chrome I don’t see any text written in Fira Sans font

    • May 17, 2015 at 4:49 am

      Hi Digital,

      It’s great that it has helped you.
      I will on the font thing.



Leave a Reply