Saltar al contenido

Translation templates, WordPress themes and plugins

febrero 2, 2020

 

Although the content manager WordPress offers support for over 100 languages ​​, including the Spanish, this is limited to the administration area ( «dashboard»), so be aware plugins or theme to install WordPress, unless they also distribute our language.

However, many themes or plugins for WordPress only have the English version and, when used, their texts appear in English in the pages and posts from our website, with evident displeasure by the user.

In this situation, we have two possible solutions: find another plugin or theme (maybe they are not to our liking or not suit our needs), or make ourselves translation of messages and texts of these plugins and themes.

At first glance, translate a plugin or theme it may seem unattainable for us because we think we have to dive into the «guts» of WordPress and we need to get to know the technology platform.

However, as discussed in this article, simply just some basics of how WordPress handles multi-language versions of themes and plugins, so that we are able to change those messages in English by other messages in Spanish.

Table of Contents

  • What texts and messages can be translated into WordPress? What WordPress themes and plugins can translate?
  • What WordPress themes and plugins can translate?
  • WordPress How do you manage the translation of texts and messages? Language folders WordPress for translations
  • language folders WordPress for translations
  • Recommendations translation plugins and themes
  • Plugin Loco Translate to translate plugins and themes in WordPress
  • Conclusions
  • What topics and WordPress plugins can translate?
  • WordPress Language folders for translations

What texts and messages can be translated into WordPress?

When working with WordPress, the text displayed within a web page can be created or generated with one of the following four methods:

  • As part of the content, whether posts or pages, written by an editor in the editor of the WordPress and containing all relevant information from that site. In this case, we can use plugins that allow multilingual versions of a post or page (like WPML).
  • blog taxonomies, such as categories and tags, also defined by the administrator or editor of the blog and can be translated using the same plugin, WPML.
  • As part of the messages of the subject. In this case, text strings are integrated within the PHP files the theme and, to translate, it would be necessary to edit these files and modify these strings.
  • As part of the messages of the plugin. A As with the topics, the text messages are within the plugin PHP files and, again, we would have to modify them to do the translation.

When we make the translation, we must bear in mind that you can distinguish two sets of messages, depending on the place where they appear on a theme or plugin:

  • In the Control Panel WordPress and therefore only you see the administrators of the website, never visitors to its websites.
  • within web pages, as part of the operation or service of the subject or the plugin, and integrated with the rest of the content of the website. So yes you will see visitors to the website.

In principle, we are more interested in translating messages «public», which may appear to users that messages from the control panel, you only see us.

In both cases, the text messages are integrated within the PHP files the theme or plugin and, as we all fall within the same lot and there is no distinction in the process to translate some or other texts.

What WordPress themes and plugins can translate?

We mentioned that to translate a plugin or theme, we should modify your PHP files, which can be an obstacle for those who do not know (or need to know) technology.

Fortunately, in the case of plugins and themes, although the messages and texts are within these files, it is possible to translate without modifying those files , but through auxiliary files that allow this translation.

However, for this to be viable, it is necessary that the theme or plugin have multilingual support, which can be found in the characteristics of the theme or plugin as «translation ready theme» or «translation plugin ready.»

When a theme or plugin are ready for translation, text messages are identified and coded within the PHP files so you can translate without modifying these files, but creating new files associate each text with translation.

Currently, most themes and plugins are prepared for translation although many do not include our language or, when they do, are translations using a different style of language that we use in the rest of the website.

is, besides translating the text messages of a topic or text, we can also change translations that are already made , to put others that are consistent with the rest of the content.

This aspect of the possibilities of translating a theme or plugin can be almost as important as avoiding messages appear in English in a Spanish website. For example, to prevent the user to see different messages for the same actions; eg «Read more» instead of «Read» or vice versa.

WordPress

How do you manage the translation of texts and messages?

When a theme or plugin is «translation ready», the message information and translations are stored in different files, you can create or modify with the appropriate editor, and identified by the extension of its filename :

  • .POT file (Portable Object Template): This file contains all text messages in their original language, which is inside the PHP files the theme or plugin and need to be translated. The .POT file is generated by the provider or plugin theme and should be included in the installation. No file .POT no can do translations.
  • .PO files (Portable Object): There will be one for each language that is translated the theme or plugin, and save the translation for a given language, each text message identified within the file name of .POT.El .PO file includes the name of the plugin or theme, language and variation containing translated messages; for example, for the Spanish of Spain, the .po file would be « -es_ES.po».
  • .MO Files (Machine Object): There will also be one for each language and contains the same information as the .po files, but in a compiled format for you to read and manage WordPress. When we have finished editing the .po file, we must compile it into your .MO corresponding file. The name of the file .MO is identical to that of the .PO file associated.

The name of the .po files includes the name of the plugin or theme, language and variation containing translated messages; for example, for the Spanish of Spain, the .po file would be « -es_ES.po».

When we finished editing the .po file, we must compile it into your .MO corresponding file. The name of the file .MO is identical to that of the .PO file associated.

From the file .POT despreocupamos us, just to know that there is, since its creation and management is total and sole responsibility of the provider of the theme or plugin, which we must supply with the whole lot.

For our part, the process that we must make to translate or change the translation of a plugin or theme «translation ready» is very simple:

This process can do from outside of WordPress, with a specialized editor, or from within, a plugin, as we shall see in the next section.

Language folders WordPress for

translations

All translations of WordPress, both the core of WordPress (ie admin panel) as plugins and themes should be stored in specific folders WordPress installation on the web server so that WordPress knows where to find them:

  • wp-content / languages: contains translation files (.PO and .MO) of the texts of the WordPress admin panel. Generally do not need to modify these files is usually not advisable.
  • wp-content / languages ​​/ plugins: it contains the translation files (.PO and .MO) of the texts of all plugins. Each file name will include the name of the plugin or theme for identification. If you uninstall a plugin, your files are not deleted.
  • wp-content / languages ​​/ themes: it contains the translation files (.PO and .MO) of the texts of all plugins. Each file name will include the name of the plugin or theme for identification. If the topic is clear, your files are not deleted.
  • wp-content / plugins / / language: alternative location to store the translation files (.PO and .MO) of a given () and where suppliers often include their own plugin translations (when they do). In this case, uninstalling the plugin, these files are deleted.
  • wp-content / themes / / language: alternative location to store the translation files (.PO and .MO) of a given topic () and where suppliers often include their own translations (when they do). In this case, erasing the subject, these files are deleted.

The following picture shows a typical arrangement of translation files into a WordPress installation, through the File Manager in cPanel tool where we can see the different translation files for various plugins:

Click to enlarge

When creating a .po and .MO file must save it in the appropriate language folder , either plugins or themes, although it is advisable to do so in the general language folder (inside wp-content / languages) to continue disposing of those files if we reinstall the plugin or theme.

Recommendations translation plugins and themes

When you translate a text message on WordPress, we must take into account some considerations to this translation fits well within the context of our website and the user is not left confused by unnatural or inconsistent translations:

  • Keep the same style or conversational tone as the other texts of the website. For example, if our website is casual and close, messages plugins should be too.
  • not literally translate the original expressions, but think about the idea that conveys the message in the original language and rewrite it to transmit the same in the target language.
  • not use colloquialisms or technicalities (unless it is a niche website). This recommendation also extends to the rest of the contents of the website: colloquialisms or highly specialized technicalities can you banish new visitors to the website.
  • Check that translations are displayed correctly. Plugins and themes have limited space to display your text messages. When we translate a text, this translation should be displayed in the same space, must be fully legible and without affecting or altering the design or display the rest of the site.
  • maintain the same expressions on the web site. This recommendation and mentioned above. We must ensure that we use the same text message to represent expressions like «back», «more», «see next page», etc.

Loco Plugin Translate to translate WordPress plugins and themes

have several systems to create, edit or modify files .PO translation of a plugin or theme:

  • using a .PO file editor, as poedit, that from the .POT file of the plugin or theme, we can associate with each text message corresponding translation. When we finished, the editor generates the .MO file and copy it to the folder corresponding language of the web server.
  • Using a text translation plugin like Loco Translate, with which we can edit the .po files from within the WordPress admin panel. At the end of doing translations, this plugin generates and automatically saves the file .MO where applicable.

When editing text messages a plugin or theme, special characters may appear in the original texts, such as those that are marked in the following picture:

is imperative that we include translation also those same special character sequences , as are used by the subject and plugins to add additional information to the text message when the web page is displayed.

For example, in the picture above we can see that the sequences of special characters «& # 8250;» and «& # 8249» texts in English on the left is also included in the texts translated into the Spanish right.

Now let’s look at the following video how to install and use the plugin Loco Translate an active website with a theme and several plugins:

Conclusions

Virtually all plugins and WordPress themes come in English and, when installed on our website, in Spanish, text messages can appear in English interspersed with our content in Spanish.

Even though the plugin or theme includes a translation into our language , it may happen that use different expressions to indicate the same action as «Read More» and «Read» or «Back» and «Go back» .

To avoid confusing the user with messages in two languages ​​or different expressions, we must be able to create, edit and modify messages original text to assign the translated text that best fits our website.

In order to translate the texts of a plugin or theme should be «ready for translation» or «translation ready». In this case, the plugin or theme will have the necessary translation files (with extensions .POT, .PO and .MO) so we can edit and modify our language.

To do this, we use an external program as poedit, which requires knowing the layout of the translation files within folders on the web server, or plugin as Loco Translate, which allows the translations through the panel board.

In either case, we must follow some good practices in translation so that the translated text fits both in the context of the website so that users do not have trouble understanding their meaning.