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.
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.
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.
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.
As soon as you select language, it will show in “Default language” section.
You can also change the order of language by using up and down arrow given besides language.
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.
After completing process hit “Publish button”. Here is the result
Creating multiple language pages is similar just as creating a post. Create a new page and fill the respective field.
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
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.
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.
There you will get multiple options to be selected.
Here we have selected “Text and Image” this will show the result as shown below.
Now you need to just click on language name. This will change language of a site to selected language.