# Translate The Theme

To translation the theme, i suggest you using Loco plugin. This plugin can help you do all things easy.

Please read guide document for detail here: [Loco Translate](https://vi.wordpress.org/plugins/loco-translate/)

Or, follow me:

Translate Theme – in cases, you need to change default texts of Our themes in your website front end. This theme is built our way that you can translate it with ease. We have already added default “.pot” WordPress language files and you can start WordPress theme translation from there.

**Translate Theme – PO/MO files**

WordPress uses 2 file  pair  with PO and MO extensions to understand where to put alternative texts inside code. PO file is a Key/Value pair file which will be used to add translations of specific phrases. MO file is compiled version of PO file which WordPress understands.

Our themes also have their own PO/MO file pair that you can use to translate different parts of the theme. Those files are located in **wp-content/themes/theme name/languages** folder.\
How to edit PO files and Compile MO file out of it

You will need a software called POEDIT to edit PO files and add your translations inside that and generate MO file out of it. It is free, works on Mac, Windows and Linux, easy use and there is no reason not to use it.

For more information please read [this article](https://codex.wordpress.org/Translating_WordPress) in details:

#### Steps to Translate theme:

**1. Set Default Language.** &#x20;

Go to Settings > General > Site Language and set it to your desired language.

**2. Install the Child Theme.** &#x20;

Install the Child Theme so that your translation will be safe upon updating core theme.

**3. Copy Languages Folder.** &#x20;

Go to **wp-content/themes/theme name/languages**  and copy folder and paste it into your child theme **wp-content/themes/theme name-child**

So that you will have a folder on your child theme called languages:

![](https://1037426047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FD6vdTSDsDRF40qqRaWfz%2Fuploads%2FBsbuDQRcGD9BWtwCierI%2Fimage18.png?alt=media\&token=de060f58-120a-4691-a253-c7e1ff68397f)

You will see  file there that you can use for translation (theme name.pot). Please consider that the name of these  files should be the same as your default language code which you have set in wp-config.php file explained at the beginning of tutorial.

**4. Use Loco Translate.** &#x20;

The Loco Translate is a third party plugin which makes it possible to edit the PO files and compile them to MO files directly from the WordPress Admin section.

**5. Alternatively Use POEDIT.** &#x20;

If for any reason you can not use the Loco Translate plugin, you can use POEDIT software to do your translation and generate MO files alternatively. For more detailed information on how to use POEDIT

5.1. You need download POEdit from: [https://poedit.net/](https://poedit.net/)

5.2. Second thing is to open default language files form your theme. in normal our theme, it is located in languages folder inside theme folder. You should use this default file for translation but you need to create a new file when you are done. Most themes has the same structure and language files should be somewhere inside theme folder. There is chance that your theme is not ready for translation so it might take time to modify.

5.3. Now in the Poedit click on original text one by one and write your translation underneath. Just like you can see iu the screenshot below. It will take some time to get through all of them so be patient.

If you think that some translations you won’t need you can leave them as they are in the original language:

![](https://1037426047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FD6vdTSDsDRF40qqRaWfz%2Fuploads%2FQyBbN0vhJwrBLjF6NfHP%2Fimage19.png?alt=media\&token=425a4298-b821-4a00-b689-9665b9358b3b)

5.4. Now the most important part: When you are saving your file in theme language folder you should use proper language code.\
For instance if you have translated WordPress theme to German you shoulduse “de\_DE.po” as file name and “fr\_FR.po” for French. This will make sure that WordPress understands what language you are referring to.\


**Please note:** Default language file extension is `.pot` (such as organic.pot... ) but you have to use `.po` in order to make your translation work. Also Poedit application will create `.mo` and it needs to be included in languages folder as well.

![](https://1037426047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FD6vdTSDsDRF40qqRaWfz%2Fuploads%2FrLlnP9DZLQFzKJpWzfgV%2Fimage%2020.png?alt=media\&token=24c29722-ef42-4e33-ad1f-a8e3ddd19f0d)

5.5. Now WordPress will use theme language the same as your WordPress language. If your WordPress dashboard uses French, don’t expect for theme to show German. Changing WordPress language will automatically\
change theme language if it is available in the theme language folder under proper name we discussed in Step 4.

5.6. Changing WordPress language is as easy as adding

```
					define ('WPLANG', 'fr_FR');
```

to the `wp-config.php` file located at your WordPress installation root folder.\


**Beware!** You need to activate your child theme from Appearance menu to see translation working.

**Beware!** You will need to clear cache to see the translation.

#### Setting Default Language of WordPress

Since the introduction of WordPress version 4, there is a new option in general settings section which you can use to select your installation default language. Go to Settings > General > Default Language to see the option.

![](https://1037426047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FD6vdTSDsDRF40qqRaWfz%2Fuploads%2FiB0Ste43qJ1oeDn2vwfR%2Fimage21.png?alt=media\&token=6c6ce418-f7e5-49da-b0ac-3cf3327607ed)

