We translate a WordPress theme into Russian with the Loco Translate plugin. How to translate a WordPress theme or plugin into Russian

Hello dear reader, today we will learn translate WordPress plugins and themes, let's deal with the purpose of the .po and .mo files, with the principles of technology gettext. In fact, there is nothing complicated in the translation operation. If the topic is ready for translation, then this business takes a maximum of half an hour, and when you get the hang of it, 10 minutes will be enough. Well, let's get started.

How the principle of translation works in WordPress

In most cases, there is absolutely no need to search for English words and replace them with Russian ones in source .php files. Why, you ask, is this the first thing that comes to mind? All because WordPress uses the free gettext technology(not even a technology, but rather a library), in the principles of which it is written that all software should be written in English, and only then should it be translated into any other language, depending on the needs of the user.

The translation itself will be in separate files with special extensions ( .mo, .po). Now more about the possible extensions:

  1. .mo- abbreviation from English machine object. This file is meant to be read by machines and is therefore binary and platform specific.
  2. .po- also an abbreviation from English portable object. This file is already human readable and well human readable and not platform specific.
  3. .pot- another abbreviation P.O template. The function of this file is visible from the name of the extension: a template / stencil for the .po file, i.e. this is a blank for creating a new .po (translation into a new language).

The principle of interaction between files is shown in the picture on the right (foo.c stands for the original English text of something).

Is WordPress Theme, Translation Plugin Ready?

This is the first question to ask. Unfortunately, not all theme and plugin creators provide for the translation of their theme and as a result don't use gettext. We will not deal with the implementation of gettext in this article. The readiness of a theme or plugin can be confirmed by 2 things: the presence of files with the extensions discussed above in the archive and the presence of a special tag in the description " Translation Ready", topics ready for translation can be found on the official website at this address, at the moment there are over 2000 such topics.


By the way, under the inscription "Translations" you can find a link by clicking on which you can see the status of the translation and contribute to the translation of the topic ( link for selected topic). For translation, select any topic and on the one who downloaded it to the computer (selected topic).

Translating a WordPress Theme with Poedit

Poedit is a free (+) cross-platform program for editing gettext files. There are quite a few other programs aimed at translating according to this scheme:

  1. Gtranslator(GNOME)
  2. Localize(KDE)
  3. tm-database online translation of .po files + translation memory
  4. Pootle online translation and translation management (most interested)

And, of course, in an extreme situation, you can always use any text editor. We will now step by step through The process of translating a WordPress theme with Poedit:


Translation of a WordPress Theme with the Loco Translate Plugin

There is an easier way to translate, without installing anything on your computer. It consists in using translator plugins that organize all the translation work right in the browser. This is exactly what Loco Translate is.

I would like to note an intuitive interface, a minimum of settings and a balanced design, something similar to the Poedit program. These aspects make the work pleasant and stress-free.


P.S. The article describes a new version that has not yet been localized itself, or simply localization does not work correctly. If this is important to you, then downgrade(and therefore change the language) in the plugin settings. But I do not recommend the more everything is more than clear.

Plugin Codestyling Localization

There is also a very handy plugin Code-styling Localization which was quite popular at the time. It is worth noting that it has not been updated for a long time and does not work well with plurals and some scripts, but in general it can still work quite well. Therefore, I recommend using other plugins presented in the article.


On this note, I end my story and leave you alone with your thoughts with: If you have any questions, write in the comments, and I will not refuse gratitude. Chao!

There are more than enough Russian templates on the Internet now, but it would be very unwise to limit yourself when searching for a range of Russian themes.

There will be several times more English-language WordPress templates; and besides, in the vast majority of cases, they are superior in quality and functionality to our themes.

By the way, many developers prefer to sell a template to a foreign user (due to his ability to pay), but we are left with mediocre themes.

In the prepared article, we will tell you how to Russify a template using the Poedit program or a special CodeStyling Localization plugin. But first it is worth considering the principle of translation itself.

Technology for translating WordPress themes into Russian

To localize WordPress, the GNU gettext standard is used, which supports not only internationalization, but also the plural function. Thanks to this, a program using GNU gettext is able to accurately determine how it should write correctly - “2 records” or “2 records”.
An important positive point is that programs that access this library create such translation files into Russian, changing which will in no way affect the structure of the template, nor the structure of WordPress itself. Simply put, when you update a theme, you don't have to redo a previously created Russian translation. Very comfortably!

In general, this technology acts as a standard for developing templates, but still not every template supports it, and the reason for this is developers who do not at all think that their themes can be translated into other languages.

You can actually find out if Russification of a particular template is possible on the developer's resource; or alternatively, the theme/template can be downloaded and installed. Those themes that can be Russified will contain translation or languages ​​folders, which will contain files for translation with the extension .po and .mo. The folder with the Russian language will have the name ru_RU.

How to translate a template into Russian in WordPress using Poedit

Poedit is a program designed to work with .po and .mo translation files. You can download this software for various operating systems at the URL: Poedit

Install and run the program, open the "Menu" item and select "Create directory from POT file". Now you need to select a .po or .pot file from the translation or languages ​​folder located in the template folder. After that, the program will ask you to fill out a transfer form, and in the next step you can save the new transfer. Throw it into the same folder where the locale is located (in our case it is ru_RU).

To make changes to an existing translation, you need to open the required .po file. There is nothing special to paint further, because the work process is simple and clear: the original text is located on the left, and the text of the translation of the topic is on the right. To make changes (Russify) just click on the appropriate line and enter the translation. After saving, the program will automatically generate your translation and make a .mo file.

Once you are completely satisfied with your translation, it must be saved; then you need to upload your theme to the hosting and simply activate it. If the theme has already been uploaded to the hosting, then it will be enough to upload the translation files ru_RU.po and ru_RU.mo to the hosting.

Note that if WordPress is customized for the Russian language, then immediately after updating the page you will notice changes; if WordPress is aimed at an English-speaking audience, then you will have to change the locale in the wp-config.php file. We are looking for the line that is responsible for the WPLANG constant and change it to the following line:

define("WPLANG", "ru_RU");

Everything, after that your template will be displayed in Russian, but do not stop there - let your work be appreciated by other users. To do this, contact the template author and send them your .po and .mo translation files. If the author approves the translation, then perhaps it will be included in the next template update, and other WordPress users will be able to use the already translated theme (similarly, you can send the translation to the plugin to the author).

Translate WordPress Template into Russian: CodeStyling Localization Plugin

The CodeStyling Localization plugin acts as an alternative version of Poedit. But the advantage of this solution is that it can also translate the plugin you need. You can install the plugin in the admin panel using the search function. After installation, another section called "Localization" will appear in the "Tools" section.

In the first window you will see all the templates/themes with installed translations, and if the required translation is not available, then click on "Add a new language". The plugin will display a pop-up window where you need to click on "Russian language" and click on "Create po-file".

Now you need to scan the files, after which we proceed to the Russification of the WordPress template (translation into Russian):

  • click on "Edit" opposite the Russian language;
  • you will see a list of phrases / words in English, next to which the "Edit" button is located, click on it;
  • we translate the template into Russian, and after the end of this process, click on "Generate mo-file".

That's all. If after the translation the plugin is no longer required, then it can be deleted, and the modified .po and .mo files will not go anywhere, i.e. the template will remain translated. The CodeStyling Localization plugin seemed more convenient to us - you can avoid a few extra steps. And besides, it allows you to translate not only the template, but also the plugin you need.

Hello friends! Today I will try to convey to you information on how to translate a WordPress theme into Russian... Everyone knows that WordPress is one of the simplest and most convenient engines for creating websites.

For all its simplicity and convenience, it is also quite functional. In particular, a webmaster can put a variety of plugins and templates on his site/blog, thereby creating a unique functionality and appearance of the resource.

Read more:

One of the main problems that WordPress site owners face is the lack of translation for a particular theme (template). For example, the template was originally created in English, and you want to use it on a Russian-language resource. If the template is not Russified, then all service inscriptions, as well as block names, will be displayed in English.

How to translate a wordpress theme into Russian by yourself? In fact, this procedure is not as complicated as it might seem at first glance. You only need to edit the code in a few files and change the pictures used in the template (provided that these pictures contain English text).

How to translate a WordPress theme into Russian

There are several ways to translate a WordPress theme into Russian:

  1. Plugins - Codestyling Localization, Transposh WordPress Translation, Loco Translate;
  2. Program Poedit;
  3. Handles!

I will not write how to translate a topic into Russian using plugins, everything is intuitive there anyway ... I’d better show you how to translate it manually ...

Let's start by editing the code. We may need the following PHP files - page.php, single.php, footer.php, comments.php, index.php, search.php, and also header.php. As a rule, almost every theme contains the above files.

What exactly needs to be done? Launch the Notepad++ text editor (handy for editing code) and open all the template PHP files in it.

Make backup copies of these files, just in case... Just copy these files somewhere before you intervene!

Now you should go through each of them, find the places where block names are displayed and service inscriptions, for example, “Archives”, “Category”, etc. In PHP code, all these labels are plain text, so Notepad++ will highlight them black bold(This will greatly simplify the search).

How to translate a wordpress theme into Russian? Your task is to change each found phrase to its Russian counterpart. For example, the phrase "Archives" should be replaced with "Archives", the phrase "Category" should be replaced with "Category", etc. In total, searching and replacing can take about 20-30 minutes, depending on the number of files and inscriptions (as well as your knowledge of English).

After replacing all the phrases in a particular file, be sure to save it in an encoding called "UTF-8 without BOM". Then see if the corrected site page displays correctly.

For example, if you edited a file:

  • single.php, then you should check the pages with the output of single posts;
  • The comments.php file is responsible for displaying comments;
  • footer.php - for displaying the contents of the footer (footer);
  • page.php - for displaying a static page;
  • index.php - for displaying the main page;
  • search.php - for displaying the search page;
  • header.php - for displaying the header (site header).

If the page did not open or opened with an error, then most likely you did not translate static text, but some kind of code construct (recall that plain text is displayed in black bold in PHP code). As a last resort, replace the broken file with a backup copy and retranslate.

If, after editing and saving the file, all English-language inscriptions have changed to Russian counterparts, proceed to the next file. After each edited file, check the page or pages for the output of which it is responsible (open these pages in a browser and view the inscriptions). This makes it easier to spot the error.

When editing files that are responsible for displaying several pages or a complex data structure (a page with a search), it is advisable to open the page in the browser at least several times. For example, on the same search page, a variety of inscriptions can be displayed, depending on the results of this search - “Search results”, “No search results”, etc. All these combinations must be checked and translated correctly.

If you cannot find the desired phrase or word in the PHP code manually, then use the "CTRL + F" combination in the Notepad ++ program. Enter the phrase you are looking for and click "Find".

How to replace pictures with English words.

Quite often, a theme contains a folder with images, which can be buttons, icons, and other interface elements. Most often, the text is present on the buttons. Our task is to replace this text or delete it.

For example, the text "Menu", placed on the button of the same name, should be replaced with "Menu". This is done quite simply. First you need to open the template folder, which contains all the images ("images").

Next, open all the pictures containing English text in Photoshop. We select the eyedropper tool, with the help of it we will accurately find out the background color of the button and paint over the English text with this color. Now on top of the filled layer, we write our name (in Russian). At the very end, save the graphic file under the same name.


Sincerely, Vladimir Saveliev

Premium lessons from the webformyself club

This is a new revolutionary product in the field of website building education! All the best video tutorials are collected in one place and divided into categories: WordPress, Joomla, PHP, HTML, CSS and JavaScript... The database is constantly updated and now there are more than 200 lessons in it! In just one year - you can become an experienced webmaster "from scratch"!

More

Working with WordPress, users often face the fact that in installed plugins and themes, all settings and the user part of the site are only in English.

Why do you need to translate?

The availability of a translation into a particular language of a plugin or theme depends on the developer. Usually popular plugins support several languages ​​(for example, WooCommerce or Contact Form 7 ), including Russian. But what if you need a certain plugin or theme that only supports English? Translate yourself!

What is a translation?

Translation of a theme or plugin is a separate file (for each language is different) with text strings that are used in the theme or plugin (names of the settings menu in the control panel, names of buttons in the user part of the site, etc.) Depending on which the site language is selected, WordPress searches for and substitutes a similar file.

How to translate a theme or plugin?

Let's consider two translation methods: using the Loco Translate plugin and the Poedit desktop application.

Loco Translate Plugin

After installing and activating the plugin, a new plugin menu item will appear in the admin panel:

As you can see, the plugin allows you to translate both the theme and the plugin.

Translation of the topic

We will do the translation on the example of the English theme Experon.

So, in the admin panel go Translator Loco -> Themes.

Before you opened a list of all themes installed on the site. Choose Experon.

As you can see from the figure, there are no translations for our topic yet. So, to create a translation file, you need to click new language. Further into the field Choose a language you should select Russian, and in the field Choose a location mark the item System(in this case, your language file will be saved even if you update the theme).

After pressing the button start translation You are taken to the language file editor.

The editor window is divided into 3 main blocks. The first block contains a list of all text resources that are used in the theme. Below it is the block of the main translation (English). The bottom one is the Russian translation. In it, we will make our translations. So, to begin with, in the first block, you need to select a text phrase that we will translate. Let it be "" Next in the block Russian translation we enter already this translated text phrase (you can use Google translator). As a result, it should look like this:

Further, choosing the next phrase, we also enter its translation. After translating the entire text, you must press the button Save. To check the translation result in our example, you need to go to a non-existent page on the site (for example, site.ru/abcdefg).

Plugin Translation

The steps for translating the plugin are similar. To get into the list of plugins, you need to go to the admin panel Translator Loco -> Plugins, select the plugin you need for translation and click new language. Next, choose the Russian language in the same way and mark System. After translating all text blocks, you will need to click the button Save.

Important!!! To apply your translations, the language of the site must be Russian. To do this, in the admin panel, go to Settings -> General and in paragraph Site language choose Russian.

Poedit application

Translation based on an existing template

To translate a theme or plugin using the program Poedit The first thing you need to do is download and install it. After installing the application, we need to have a language file (in English) with all the text blocks. In our example (subject Experon) the translation file is located in the theme directory:

/wp-content/themes/experon/languages/experon.pot

Language files are usually located in a subdirectory languages the main plugin or theme directory.

If the site is already hosted, then the file will need to be copied to your computer (for example, via FileZilla). If the site is located locally, then for this you just need to specify its location.

So after running the program Poedit, you will be prompted to select an operation:

To start translating, select Create a new translation and point to the translation file (in our case, this is experon.pot). After pressing the key Open, You will be prompted to select the future translation language. Choose Russian and press the button OK. As a result, you will be taken to a window in which you will see the already familiar 3 blocks.

We will translate the same phrase (“ Sorry, we could not find the page you are looking for.”) So, inserting the translation in the block Translation:, it should look like this:

After inserting all the translated text blocks, you must click the button Save. The program will prompt you to create a new file, prompting you to give it a name. The file name must be specified experon-ru_RU. The first part of the name is the theme name, and the second part is the language. Note that it is important to adhere to such a scheme, otherwise the translation simply will not work.

As a result, 2 files were created:

experon-ru_RU.mo experon-ru_RU.po

They will need to be placed in a directory

/wp-content/languages/themes

As a result, your translation will be saved even if you update the theme.

The situation is similar with plugin translation. Only these 2 files will need to be placed in the directory

/wp-content/languages/plugins

Create a new template

Creating a new template is necessary if you are, for example, developing your own WordPress theme or plugin. Usually, in the theme/plugin source code files, special WordPress functions are used for further translations, which allow you to substitute the translation string in the required language. Since there can be quite a lot of theme / plugin files, it will be difficult to find all translatable text phrases.

As a result, when translating a theme or plugin into a particular language, Poedit will be able to independently search for text blocks for translation. To do this, he needs to specify the names of the above WordPress functions.

Let's consider the creation of a new translation template using the theme as an example. For the plugin, all actions will be similar.

So, to create a new template in the program Poedit needed on the menu File select item Create, and specify the translation language. Next, you need to save this template file (usually /wp-content/themes/YourTheme/languages) by pressing the button Save and indicating his name (for the Russian language it should be ru_RU). That's it, the template has been created, and now you can proceed to filling it with text phrases of your theme.

By default, the WordPress site itself is in English, however, you can create a WordPress site in Russian and more than 80 other languages: Spanish, German, French, Portuguese, Italian, Chinese, Japanese, Arabic and many others. You can create a WordPress site in any language you want or make a multilingual version. In this series of three articles, I will tell you how to create a WordPress site entirely in Russian and how to translate it into other languages.

Every detail needs to be taken into account when it comes to creating a multilingual WordPress site, so I tried collect key information in a series of three articles.

I really hope this article series helps you understand the basics of what it takes to get started on your journey of creating multilingual WordPress site and give you the confidence to get started.

  1. WordPress completely in my language (current post)

Introduction

Although initially displayed in English, WordPress is very easy to localize and can be used to create websites in multiple languages.

The WordPress user community has created localized versions of WordPress in many languages, and there are a large number of themes, plugins, and services in many different languages. You can check existing localizations at this link: https://translate.wordpress.org/languages ​​.

Currently, the WordPress system is translated into Russian (under the code ru_RU) and other 80 languages, including various variants of some of them.

In this article, I will show you how to create a WordPress site entirely in Russian (or any other language), which is the first step in creating a WordPress site in multiple languages ​​(if you need multiple versions of your site)

Here are the steps we will go through:

  1. Setting the Russian language through the WordPress control panel;
  2. Installing a WordPress Theme translated into Russian;
  3. Installing plugins for WordPress translated into Russian;
  4. Creation of content in Russian.

1. Installing the Russian language through the WordPress control panel

Starting with WordPress 4.1, you can install new languages ​​(and change the display language of your site) using the WordPress dashboard. And it's really very simple.

You don't have to change the WPLANG setting in the wp-config.php configuration file (which is now deprecated). All you have to do is go to the section Settings > General > Site Language , and install a new language (Russian or any other).

In this way, you can set the main language of the WordPress system literally on the fly. Note that the dropdown list contains installed language packs and packs available for download.

You can find the language files of the system in the WordPress folder specially created for this purpose:

  • wp-content/languages

You will see four separate files (two each with .po and .mo extensions) containing text strings. For example, Russian language files:

  • admin-ru_RU.po: the text part of the WordPress dashboard;
  • admin-network-ru_RU.po: text part responsible for the network interface - WordPress Multisite;
  • continent-cities-ru_RU.po: names of continents and cities;
  • ru_RU.po: text part of the user and administrator parts of the site.

Key localizations for WordPress were done by the WordPress user community. You can take part in improving the Russian translation using the GlotPress platform. To do this, you need to be logged into your WordPress.org account. If you don't have an account yet, you can register a new user.

If you want to create a custom localization with modified text or a less official translation for your site, then you will need the Poedit software used to personalize language packs (see this series).

2. Installing a WordPress theme translated into Russian

There are WordPress system language files and language files for themes and plugins. Not many WordPress themes are localized and translated into Russian, but most of them "support localization", which gives you the opportunity to translate them into Russian using Poedit , Loco Translate or Codestyling Localization for this purpose (see).

How can I find out which topics have already been translated into Russian? You will have to familiarize yourself with the features of the theme before installing. Here are some things to keep in mind when choosing a theme:

  • Languages. If the theme you have chosen is already translated into Russian, then it should come bundled with .PO and .MO files for Russian. Some themes include a translated user part (usually the text a user sees when they visit your site), while others also include a localized version of the admin panel;
  • Supports localization. If the theme is marked as “translation ready”, then it will include .POT or .PO files that can be used to translate the theme into Russian or any other language, but, as a rule, such themes do not include ready-made translations into other languages;
  • RTL compatible. Supports right-to-left languages ​​(Arabic, Persian, Hebrew, etc.);

There are both free and premium themes that are already translated into Russian. By using a ready-made theme, you can save time and money.

Free themes

  • Standard WordPress Themes(Twenty Ten, Eleven, Thirteen, Fourteen and Fifteen) were translated using GlotPress. These free themes are translated into more than 50 languages ​​(including Russian). You can find the language files for each of the themes in the folder:
    • /wp-content/languages/themes
  • Also, you can find free multilingual themes in the database (directory) WordPress, using the tag to search. You will be able to find language files in this folder
    • /wp-content/themes/theme-name/languages

Premium Themes

Not many premium themes have been translated into Russian. Please, if you know other premium themes localized in Russian, be sure to let me know and I will add them to this list:

  • Genesis Framework. Translated into more than 30 languages ​​(including Russian).
  • AitThemes. Translated into more than 23 languages ​​(including Russian).
  • Pagelines. Supports Dutch, Russian, Spanish, French, Hebrew, Finnish and Portuguese.
  • Elegant Themes. Divi has been translated into 32 languages ​​(including Russian).
  • themeforest. The most popular themes from this store usually come with translation. Here are two examples of topics translated into Russian: Avada (27 languages) and Enfold (19 languages).

Features of these localizations:

  • Such companies typically do not provide user support for community-created localizations using collaborative language platforms such as GlotPress, Transifex, or Webtranslateit.
  • If you need to make changes to the translation or create a new language pack, then you will have to use the Poedit software package (see).

3. Install WordPress plugins in your native language

The next step is to use multilingual plugins. Just like WordPress themes, not all available plugins are translated into Russian or “support localization”.

The WordPress plugin database does not allow you to search for plugins that have already been translated into Russian, so if you plan to use plugins, then you need to read the description of each of them to check if the Russian language is available or at least the possibility of self-translation. You can also contact the developer for details.

Most free and popular plugins have already been translated into Russian: Contact Form 7, WordPress SEO par Yoast, jetpack, Mail Poet Newslettersand others. In addition, many premium plugins are also translated or support different localizations. You can check this information on the plugin description page.

The use of multilingual plugins is extremely important if they are responsible for the information displayed in the user area of ​​your WordPress site: contact forms, radio buttons, widgets, and others.

Plugin language files are located in the following folder:

  • /wp-content/plugins/plugin-name/languages

4. Create content in your language

The last step is the easiest. You just need to create the necessary content (posts, pages, sections, blanks, menus, widgets, and more) in Russian. This step is entirely up to you and your preferences.

Do you want to translate your website into other languages? Check out to explore your options.

Liked the article? Share with friends: