Pageloader

Language Translation

Translate Your Theme - Basics

  • Login to your FTP account and edit the wp-config.php file
  • In the wp-config.php file, look for WPLANG constant which looks like: define(‘WPLANG’,”); or that constant is not available in the wp-config.php file, you need to add it anywhere in a new line in this file.
  • Define the WPLANG constructor by adding the ISO Language code of your language. The names consist of locals, a combination of language and regional dialect. For example, if you were translating to Deutsch language, change the WPLANG constant to look like the following code: define(‘WPLANG’, ‘de_DE’);
  • After the wp-config.php file is edited, login to WP-admin dashboard and navigate to the Settings tab, then to the General Settings page.
  • In the General Settings page, make sure the Site Language field is set to your desired language.
  • Note: First 2 characters of a language code define the Language, the last 2 characters define the Country. Click here for more information on the ISO Language Codes.

Storing Translation Files

Storing translation files in the right directory is very important to make sure the translations you’ve downloaded, created or edited. The best way to do this is store it inside the Languages folder located inside the wp-content folder.

To Store Theme Translation Files

  • Place your theme translation files inside wp-content/languages/themes folder. If you don’t have the languages and themes folder, simply create the languages folder, and the themes folder inside it.
  • Updating the theme will not overwrite the wp-content folder. Storing your translation files here will ensure they stay intact during updates.
  • When storing your language files, remember that the file structure is different and must include the theme name, as well. For example, if the language files are in the Deutsch language, the file names would be zozothemes-de_DE.mo and zozothemes-de_DE.po.

The Translation Process

This section will explain where you can find the files needed for translation and what these files are for. Inside Our Main Theme folder, you will find a folder called Languages. If you have downloaded the Installable WordPress Package file, you will find these files in the Languages folder:

zozothemes.pot – A list of all the text strings used in the Theme files. These text strings are in the English language, and can contain a translation for each text string.

If your language is not already included, you need to create a new .po file from the original zozothemes.pot located in the Languages folder, translate all text strings, then save the .po file with your language code.

  • Either you are setting up a completely new language file or you just want to edit translated pre-built language files, follow the steps to make easy.
  • The language files can also be used if you only want to translate a small portion of the theme, or one specific area. You do not have to translate the entire theme, you can choose what you translate inside the zozothemes.pot file. This is the preferred method for translation.

Edit The .pot file Using POEdit Software

To edit the .pot files, you need to download the POEdit software. Click on this link to download poedit.net. There are different editors for editing .po files, but poedit.net is easy to use, it is available for all platforms and it is freeware.

  • Open POEdit and select the Create New Translation button to open the zozothemes.pot.
  • Once it has loaded, You will find all English text strings in the left column called Source Text. Once you add translations, they will show up in the right column under Translation.
  • Choose the line you want to translate. In the lower right section of the POEdit window, you will find a text area where you can add the correct translation.
  • When you are done translating all the needed text strings into your desired language, save the file with the theme name and your language code.
  • For example, if you were translating to the Deutsch language, you would save it as de_DE.po. The corresponding .mo file will be auto created.

To Edit A Pre-Built Language File

Everytime you update the .pot file, make sure to upload both .po and the compiled .mo file as correct file name. The correct file name is the theme name and your language code. For example, de_DE.po.

  • Open the .pot file of your preferred language in POEdit and search for the line you want to change. Select the Edit button to change, then select the Find option.
  • In the Search Window, type the text string you are searching. Once it is selected, replace the text in the Translation text area in the lower part of the window with your prefered translation.
  • Repeat the steps to edit another text.
  • Once done with your translations, Save the file and .mo file will be auto created with updated.