There are cases that we need to change default texts of Jupiter or Ken theme throughout website front end. Our themes use WordPress text domain capability, so there is no need to change any theme core files to achieve this goal. To make this happen you need to know few points.
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.
Jupiter and Ken 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/jupiter/languages folder for Jupiter and wp-content/themes/ken/languages folder for Ken.
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. For more information please read this article in details:
Steps to Translate Jupiter or Ken Theme
Go to Settings > General > Site Language and set it to your desired language.
Install the Child Theme so that your translation will be safe upon updating core theme. For more information please click here.
Go to wp-content/themes/jupiter/languages for Jupiter and wp-content/themes/ken/languages for Ken and copy folder and paste it into your child theme wp-content/themes/jupiter-child for Jupiter and wp-content/themes/ken-child
So that you will have a folder on your child theme called languages:
You will see 2 files there that you can use for translation (en.mo and en.po). Please consider that the name of these 2 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.
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. Click here for more detailed information on how to use the plugin for the theme translation.
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 click here.
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.
Frequently Asked Questions
The translation is not working. What is wrong?
It might be because of wrong location of the po/mo files. Please make sure you enabled the child theme and put the correct language file inside the languages folder in the child theme. Also, please make sure the file names are the same as the html lang attribute in your page.
Text does not exist in the po file.
Please make sure you are trying to translate the text domains in mk_framework. Otherwise you need to find the correct text domain and provide the correct language file. For more information, check out this article.