Making the greater part of the WordPress in English. Of course, there are topics in Russian and other languages, but the majority still remains in English. In this regard, may be necessary in the Russification of the themes on WordPress.
This article will help you to understand how to localize the template on Russian language using the program Poedit, and how to translate WordPress themes using a plugin called CodeStyling Localization.
At the outset it must be stressed that translation into the Russian language the English strings inside source files .php themes – a misconception. This mistake is made by many novice developers and users of WordPress.
For localization in WordPress uses the GNU gettext technology which suggests that software source code should be written in English. Why?
This will allow, for example, to translate into Russian a WordPress theme without making changes to the source code of the template. Importantly, during the release of updates to the templates, the translation will not go away.
Russification WordPress theme
Sometimes, unfortunately, not every theme for WordPress it is possible to translate the “right” way. It all depends, did the developer preparing my theme for translation.
Where to find the pattern, ready to transfer? In fact, it is easy. For example, on the website WordPress.org there is a special marked translation-ready, pointing to the fact that the subject prepared by the developer with the translation, and you will be able to translate it into Russian language, without modifying the original source code.
If you choose a topic not from the official site, then the information about whether the template for translation, check with the developer.
Tip! Templates for WordPress need to download from the official resource. To use themes with the “left” sites, especially if they are free, very risky.
Files .po and .mo
After downloading the theme, go to step “How to translate WordPress theme to Russian language?”. Looking for in the theme directory languages. It can find the necessary files to translate the theme into different languages. The file name should indicate the locale. For example, en_us is Russian. All of these files come with the extension .po and .mo.
.po files are stored in text format translated strings. These are accessed by the interpreter of the theme.
.mo files are the same line, but in compiled version. Data files are used by WordPress core for display of translation.
Editing the transfer file .po, it must be compiled in .mo, to confirm and apply the hotfix. Using the editor, Poedit, this can be done automatically.
How to localize WordPress using Poedit
Poedit is an editor .po files (gettext catalogs) responsible for the translation software. Most of the developers prefer gettext, so as to localize the Unix programs. So, decided to translate your favorite programs on Linux, you can safely use Poedit.
What features has the editor Poedit:
- There is a spell check.
- .mo files are compiled automatically.
- There is support for plural forms.
- Have the ability to edit comments.
- The availability of suitable line search.
Download Poedit editor at the link https://poedit.net/download.
Running the program to create a new translation you need (via the File menu) to create the POT file directory.
Select .pot file (or .po) in the languages directory of your theme. Then the editor offered to fill in the transfer form and keep a new created directory. Save it in the same languages directory under the locale name, for example, en_us.po.
If necessary, for amendments to an existing translation, you need to open the corresponding .the po file.
Editor Poedit does not cause additional issues. Everything is simple and clear. The original version of the text is on the left and the translation on the right. To make adjustments to the translation, click on the appropriate line and enter the correct translation. Clicking save, the editor will compile a new translation and creates the appropriate .mo file.
Install transfer WordPress
After making final changes in the translation, remember that it needs to be saved. The next step is to upload the theme with the Russian translation on the site and its activation.
If the website theme is already installed, then just download the files en_us.po and en_us.mo in its directory languages. This can be done, for example, via FTP.
If the template is installed in the Russian language, the changes will be visible immediately. If it is in English, one can change the locale in wp-config.php. You need to find in file line WPLANG and change it:
As a result, the theme on the website will be displayed in Russian language. However, this is not the only way!
How to localize WordPress using the plugin?
Plugins for WordPress are widely used for setting of various functions. This case will be no exception. The plugin CodeStyling Localization, in this case, it will be very useful.
- To use the plugin, the first step is to download it and install it. In the console, find the Plugin-Add new.
- In the search box enter CodeStyling Localization and click Search.
- When the search finds it, click Installand then Activate.
- On the console menu on the side select the Tools-Localization.
- A list will appear consisting of localizations WordPress installed themes and plugins. The bottom will be placed the name of the desired theme. If not, then to Russify the topic will have in the way stated above.
In the absence in the list of the Russian language, click Add new language and Russian note. In the place of the Russian language press to Scan and Complete. Next in the line of the Russian language, select to Edit. Opens a list of phrases and translations to them.
You can edit each sentence by choosing the corresponding action on the right.
A phrase is displayed with the %s at the end. These external links is possible in some cases to get rid of. For example, the translation “Powered by %1$s and %2$s theme by %3$s” can replace “WordPress” with no links.
Translate all the phrases are not necessarily the most important. Checking and editing the translation, click on the phrase list to Generate the mo file.
Completing all stages and understanding how to localize a wordpress template, the plugin CodeStyling Localization you can easily remove it, as even after all of this .po and .mo files are saved.
Many users, choosing a WordPress template to get scared after seeing an English-language interface. Why do not all realise this is just a template that you can customize and modify. Therefore, choosing a suitable template in English, it is not necessary to abandon it, so as to localize WordPress will be able even a novice.