This article describes how to localize the themes and plugins using several methods and change the default strings without changing the site language.
You can change your site main language via Settings -> General -> Site Language.Theme and plugin language files are located in a ../wp-content/themes/theme-folder/languages/ and ../wp-content/plugins/plugin-folder/languages/ folders respectively.
There are two ways to fill up translations:
Follow the link to watch the video tutorial:
The easiest way of translating the theme is by using the Loco Translate plugin. After installing this plugin the Loco Translate menu appears in your dashboard menu. You need to go to Loco Translate -> Themes and select the theme which is active in your WordPress.
Most of our themes are contain ready translation files in multiple languages. If there isn't a needed language, then you can create a language file by clicking on the New Language link.
In this section, you need to select the language and select the location from the Other option as shown in the picture below. You choose the same language which you set in the WordPress Settings -> General.
After, click on the Start translating button. It will create a translation file and redirects to the Loco Translate editor where you can start translating the theme strings.
The process of translating plugins is the same. You should just go to the Loco Translate -> Plugins section and select the needed plugin.
In order to keep your translations during theme updates, we recommend to save them in ../wp-content/languages/themes/ and../wp-content/languages/plugins/ folders respectively.
There are constant updates for every theme. And once you have updated the heme, applied changes in the content may not be translated. This happens because of the discrepancy of your old template and updated theme content. To solve this issue you need to renew the template for translation.
Open Loco Translate from the dashboard menu. Go to Themes under the Loco Translate and select the active theme.
After you opened the theme page, find there an option Edit template.
Click on it and open the Editor page. Switch to the Delete tab and delete the existed template.
After this, you will be redirected to the Theme page where you can find a new option Create template.
Go to this page and click on the Create template button.
The new template will be created automatically, and once the process is finished, you will be forwarded again to the Theme page with a confirmation that the template file is created.
Now you can apply changes to a particular language. Go to Loco Translate > Theme, select an active theme. On the theme page select the language you need to update.
Use the Sync button to synchronize the data.
You will get a specific notification about the changes applied. The message with green indicator shows that synchronization was successful and tells you what was exactly changed — either strings were added or removed.
The same principle is applicable to plugins. Just instead of Themes, select Plugins under the Loco Translate.
Besides the Loco Translate plugin, you can use a PoEdit platform. You can add translation via editing your .po file and at the end, PoEdit generates .mo file for you. Then you can upload ready translation files to primordial folder (../wp-content/themes/theme-folder/languages/). Before adding translations for static strings it needs to rename language files correctly according to your site languages. You can find a list of language codes at WordPress in your Language. As an example, the language code for English is en_EN, so you would save the translated files as en_EN.po first, then en_EN.mo.
There are some static strings, which come with theme and plugin templates. For example: read more, Login, Register, learn more etc. The best way to change these strings would be through the translation files. To change any theme generated text, you can use the same process described above.
You can add translations even for your default (ex: English) site language.
The screenshot above displays that "cars" string of the theme can be changed to "bikes" in the same language. After saving changes, you will be able to review the changes on the website.
As you can see, "cars" string has been replaced with "bikes" string on the frontend. You can change the theme and plugin strings by using the same actions.