Translating a WordPress Theme
Mar 10, 2016 by Micro ThemesExpand Text
This section will provide a general overview of how to edit and load a language file bundled with a WordPress theme. Language files usually contain translations for inaccessible parts of a WordPress theme (such as widget items and menu buttons and possibly certain areas of the theme’s front-end as well). In order to translate content such as pages or posts you will need to use a plugin such as LocoTranslate or WPML – this topic does not cover either of these plugins.
This topic will demonstrate how to translate an English .pot file to a Spanish .po file using the POEdit software. In this example we will be working with the .pot file from our Quantum theme but the steps apply to any WordPress theme in general.
Locate the root folder of your WordPress theme and look for a folder labelled “languages” – this folder should contain a .pot file which is the main catalogue file. Open the .pot file in POEdit as demonstrated in the visual image below:
The .pot file by default does not have a language for translation assigned to it so we will do that in the next step.
Along the bottom of the POEdit interface (beneath the Source text column) you should see a large grey box with a button labelled “Create New Translation” – click on this button to get the Translation Language popup and assign a language for translation to your catalogue file. In this example we will select Spanish from the “Language of the translation” select list. See image below for reference:
Once you’ve assigned a language to your file you should see two new translation columns appear – the first column, “Translation — Spanish“, displays your translations next to each English translation and is adjacent to the “Source Text – English” column. The second column is the actual translation insert field where you insert your translation for the selected English text from the “Source Text – English” column – this column is located beneath the “Source text” column. At this point you can start inserting your translations for each English entry in “Source Text – English” column. See image below for reference:
When you’re done inserting your translations go ahead and save your file – POEdit will now save your file with a .po extension and will also generate a .mo file as well. For this example because we’ve assigned the Spanish language to our file we are going to save the file with the appropriate language code – in this case the filename will be es_ES.po. You can use the following link to find your desired language code(s): https://wpcentral.io/internationalization/
Once you are done saving your file make sure it has been saved to the languages folder that resides with the root directory of your WordPress theme. Then log into your WordPress website and go to Settings -> General to and set your desired language from the Site Language select list. In this example we have selected “Espanol” from the Site Language list since we are working with the Spanish translation. And that should be it – your WordPress theme should now be translated. See image below for reference:
A few notes to keep in mind
Translation files are meant to translate static inaccessible areas of a WordPress theme. If you need to translate dynamic content such as posts, pages, categories, tags, custom post types etc. you will need to use a translation plugin such as LocoTranslate or WPML.
Furthermore the steps outlined in this example are only for translating a WordPress theme. If you need to translate a WordPress plug-in click here for instructions.
Thanks for reading – we hope you found this article useful.