Translate your theme with qTranslate-x.

Translating WordPress site or Translate theme is little difficult for us using .po files. It’s a time-consuming process and not helpful to a newbie who is just started using WordPress. So this blog post will help every user of WordPress to translate their site into easy steps.

Installing Plugin

There are two methods to install a plugin in your dashboard.
a. You can directly install a plugin from your dashboard plugin section.
For this you need to open your dashboard and select “Plugins > Add New”. Here in search field write “qTranslate-x” and hit “Enter” key.
1st

As soon as you hit enter key search will show you a list of plugin, you need to install a very first plugin. Just click “Install Now” button and then activate it.

b. Or you can download a plugin from https://www.wordpress.org/plugins and add a plugin to your “wp-content/plugins” directory. This will show plugin in your dashboard (Plugins > Installed Plugin) you need to just activate plugin there.

Translate theme

Enabling Language:

Now first process after installing plugin will be to select your languages in which you want to show your website. For this go to “Settings > Languages”. Multiple languages are available; you need to just enable languages.

3

As soon as you select language, it will show in “Default language” section.

3rd
You can also change the order of language by using up and down arrow given besides language.

Creating Multilingual Posts :

To create multilingual post go to “Posts > Add New”, Here you will get two title field both for “English” and for “Deutsch”. It is because we have selected only two language.
And in post editor section you will get two tabs one for “English” and another for “Deutsch”.
You need to write title and content of a post in both the language. The best way to write it in both the language is to first convert all text using “Google Translator” and then paste it in your editor.

4th
5th

After completing process hit “Publish button”. Here is the result
1
2

Creating Multilingual Pages:

Creating multiple language pages is similar just as creating a post. Create a new page and fill the respective field.

page1
page2

Check out result

Translating Theme By Customizer:

Before translating theme you need to know about code line. This will help you to write content in all language
<!-–: en–-> Your text goes here<!–-:–-> or [: , en]Your text goes here[:]
Above line will define that the text given is English te because in a code we have written “en” which specifies that this is English language text.

Likewise, you can write text for Deutsch also, you just need to change the code of language. For example
<!-–:de–->Your text goes here<!–-:–-> or [:de]Deutsch Text[:]

Here “de” is Deutsch language code.
You can get list of code from this link : https://www.w3.org/WAI/ER/IG/ert/iso639.htm#2letter
custom-code

Like wide you can use these codes to translate each section text.
Using PHP code to translate:
To translate text in PHP file you need to add code in PHP format. Please check the code below.

<?php _e(“<!–-:en-–>English text<!-–:–-><!-–:de-–>Deutsch text<!-–:-–>”); ?>
Complete format should be used in php
file, then it will translate text in correct way.

Adding widget in theme:

As soon as plugin is activated it gives a widget in “Widgets” section, you can add it in Footer area where user can click on language to translate website in selected language.

3

There you will get multiple options to be selected.
Here we have selected “Text and Image” this will show the result as shown below.

9

Now you need to just click on language name. This will change language of a site to selected language.