translate WordPress theme

WordPress is the fastest-growing content management system powering millions of websites across the internet. WordPress core has been translated to many foreign languages by WordPress Core Team while WordPress theme translation remains the role of theme authors.

Allowing WordPress users to manage or create websites in their native languages is very important. As the WordPress community continues to grow globally, there is a need for WordPress themes and plugins to be translated into different languages.

Translating WordPress themes and plugins becomes very important especially for themes listed in the WordPress repository and premium marketplaces for users who do not speak English as their native language.

Translating themes and plugins allows users to build websites in their native. Translating WordPress theme is also commonly referred to as ‘localization’ which simply means translation of the theme content, descriptions, WordPress instructions, and customizer to a local language. It is important to note that theme translation does not mean translation of the WordPress pages and posts but the language used in the theme’s files. By default majority of WordPress themes are developed and written in English and most of the translation is done from English to another language.

Translating WordPress Theme

The following are a few steps to take in order to translate a WordPress theme to your desired language:

Step 1: Check if your Theme is Translation Ready

There are many WordPress themes both free and premium that are ready for translation. If you are looking for a translation-ready theme there are several free themes listed in the WordPress repository as translation-ready.

You can search for translation-ready themes on the WordPress repository using the Translation Ready tag.

translate WordPress theme

You can identify several themes on the WordPress repository that are translation ready then you choose the theme of your choice and download it.
In this tutorial, we will be translating Twenty Sixteen WordPress themes to the Swahili language.

translate WordPress theme

A translation-ready theme contains a language folder with a .POT file. This file is important for the translation of your WordPress theme and it can be found inside the languages folder theme/languages/ among the WordPress theme files.

This file extension POT stands for portable object template or sometimes abbreviated as .PO means portable object while MO stands for machine object.

Translate WordPress Theme

Step 2: Begin Translation Download and Install Poedit

To start your theme translation you need to download and install in your machine poedit which is the ideal gettext translation file editor for WordPress.

You simply go to this website Poedit download and install this translation aid software on your computer. This software can be downloaded for free by both Mac and Windows users.

Translate WordPress Theme

To install the software click on the .exe installation file then follow the prompts to install poedit in both Mac and Windows.

When you have successfully installed poedit software on your computer you should now launch the program to begin your theme translation.

If you are successful you should see the following welcome screen of this gettext file editor.

Translate WordPress Theme

Step 3: Create a Translation from the Existing PO theme file

When you look at the welcome screen of poedit software there are three options available, which include editing a translation, create a new translation, and translate a WordPress theme or plugin. In our case, we will utilize the second option since the third option is only available for the premium version of this software.

You should now choose the ‘Create a translation’ option and navigate to the location of your .POT file inside your WordPress theme.

In our case, we will be translating the WordPress Twenty Sixteen theme to the Swahili language. This process involves picking the preferred language, this process is the same for all available languages.

POT Step

Step 4: Translate and Edit the Translations from the Poedit Screen

You should now begin the process of translation by picking your preferred language from the list of all available languages.

Translate WordPress Theme

 

When you pick the language you should now see on the left side the list of WordPress phrases in English with equivalent translation suggestions on the right side. You should now click on each of these translations and edit it on the bottom left side to improve its accuracy. You can save your translation and edit it later if you don’t have enough time to edit all the phrases in the file.

Step 5: Save Translation Files and Enable Translation in wp-config

When you have finished editing all the translations files you should now save them as .PO and .MO files and ensure they are saved or uploaded in the languages folder of your theme. It is very crucial to ensure that both files are saved and uploaded to the languages folder for successful theme translation.

translate wordpress theme

You should also ensure these files are named well according to the language code. After saving these files we are now ready to enable the translation by editing the wp-config.php file in the WordPress installation to complete the translation. If your site is live you should use the FTP to locate the wp-config.php file and edit it. Ideally, on a live site, the file will be found inside the public_html/site directory path.

When you locate this file wp-config.php open it and locate the following line of code:

define ('WPLANG', 'en_EN');
In some instances, this PHP CONSTANT for defining language may be missing inside the wp-config file. If this line of code is missing, you just need to copy it inside the file, make the changes and save the file.

Now it’s time to change the theme language to our preference. In the case of this tutorial we should substitute it with Swahili language code:

define ('WPLANG', 'sw_KE');
The first part of this code shows the language you translated your theme to while the second part of the code shows the country. In this case, ״sw״ is the Swahili language code while ״KE״ is the country code of Kenya. The language code should always precede the country code and they should be separated by an underscore. You have now successfully defined the preferred language and now it's time to save and close this file then check your website to see if the translation is successful.

Translate WordPress Theme

This is the result of successfully translating the Twenty Sixteen theme to Swahili. You can apply this tutorial to translate any theme in any of your preferred languages.

Finally, you should remember that WordPress theme translation is a progressive process that you can keep working on, saving your new edits of the .PO file which will be reflected on your site immediately. Please share your thoughts, opinions and feel free to ask questions using the comment section below.