Translating your website

Translation overview

If you are new to translating WordPress, you’re in the right place! In general, internationalization and localization (commonly abbreviated as i18n and l10n respectively) are terms used to describe the effort to make WordPress available in languages other than English for people from different locales. The actual localization is done using the GNU gettext framework, which is used by WordPress itself including the themes and plugins.

Here are overview steps for translating your site.

  1. Set your WordPress for the language so the admin section will be in your language
  2. Create language PO file for translation
  3. Modify the PO file using POEdit software and translate all strings in it. This will also generate MO file which is used by WordPress



1. Set your WordPress for the language

In order to make WordPress recognize the language to which you want to translate the core WordPress, the theme or the plugins, you have to define the language within the wp-config.php file or change a setting within the dashboard. The process is dependent on the WordPress version and is described below:

For WordPress 3.9 and older versions

To Translate WordPress, Follow These Steps.

Step 1 – Login to your FTP account and edit the wp-config.php file.

Step 2 – In the wp-config.php file, look for WPLANG constant which looks like:
define('WPLANG', '');

Step 3 – 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');

IMPORTANT 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.

For WordPress 4.0 and newer versions

To Translate WordPress, Follow These Steps.

Step 1 – Login to your WordPress admin section.

Step 2 – Than go to Settings > General section and change language from the Site Language dropdown.

Step 3 – Save the settings and done.




2. Create language PO file

Storing translation files in the right directory is very important to make sure the translations you’ve downloaded, created or edited remains functional and intact. There are two ways to store translation files. The first method is storing it inside the themes folder located at the wp-content/languages/themes folder, and the second method is to create a new folder inside wp-content named labpeak-languages (this is for safety).

Translation files

We are providing translation files so you can translate your site easily. Just follow the steps given below:

  1. First you need the PO file to edit it and add your translation in it. We are providing labpeak.pot file in our theme folder so you can find it at /wp-content/themes/labpeak/languages/ folder. the file name is labpeak.pot. You can create PO file from this POT file and add your translations to PO file

Method 1: Storing Inside The /wp-content/languages/themes Folder (recommended)

Generally language files are in the themes folder (that is 3rd method) and you put inside it. But the theme update will remove the language files so we recommend you to put your files outside of the theme folder.

Placing your translation files inside /wp-content/languages/themes folder will make your language files safe and it will not be removed on update. So updating the theme will not overwrite the wp-content folder. Storing your translation files here will ensure they stay intact during updates.

If you choose to store your language files using this method, 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 labpeak-de_DE.mo and labpeak-de_DE.po.


Method 2: Storing Inside The /wp-content/labpeak-languages/ Folder (for safety)

Generally language files are in the themes folder (that is 3rd method that we don't recommend so we haven't described it) and you put inside it. But the theme update will remove the language files so we recommend you to put your files outside of the theme folder.

Placing your translation files inside /wp-content/labpeak-languages/ folder will make your language files safe and it will not be removed on update. So updating the theme will not overwrite the wp-content folder. Storing your translation files here will ensure they stay intact during updates.

In order for WordPress to recognize the language to which you want to translate the theme, you must name the Language files accordingly using the ISO Language Codes. For example, if you wanted to translate labpeak to the Deutsch language, the filenames would be de_DE.po and de_DE.mo.




3. Modify the PO file using "POEdit" software

There are different editors out there for the purpose of editing .po files, but POEdit is easy to use, it is available for all platforms and it is freeware. To download POEdit, follow this link.

For example, just open the recently saved de_DE.po or labpeak-de_DE.po (depends on which step you are following) in this POEdit software and start editing it. Add translated word and save the changes.

IMPORTANT NOTE - You just need to edit the PO file and MO file will be generated automatically. The MO file is encrypted file and it will be generated by the POEdit software when you save the file. The MO file will be used by WordPress for translating strings.