With the practical Loco Translate plugin you can translate themes and plugins directly in the backend of WordPress. Translations can be easily created and changed - the plugin automatically creates the required language files.
Localization in WordPress
Text phrases in WordPress theme and plugin files are usually written in English. In the case of texts in the frontend, in particular, on non-English websites the desire to translate them into the respective national language arises.
WordPress uses language files for localization. Each project (theme, plugin) contains a .pot file that contains all text strings and serves as a template for translations. For each language .po and .mo files can now be created, which contain the translations and are loaded based on the language set for the website.
To translate a theme or plugin, a new language file must be created, translated and then uploaded with the correct name to the correct folder of the WordPress installation. The last two points in particular often cause confusion because WordPress knows different storage locations and naming conventions.
Translating with the Loco Translate plugin is therefore a little easier.
The plugin is available in the WordPress plugin directory and was completely overhauled as version 2.0 just a few months ago.
Over 1.8 million downloads, 400,000+ active installations, 200 five-star reviews.
The numbers speak for themselves.
Loco Translate adds a completely new menu item in the WordPress backend. From there, all currently installed themes and plugins of the WordPress installation can be selected and translated.
When you select a theme or plugin, existing translations are displayed. For themes and plugins from the official WordPress.org directory, please note that language files are only installed when they are needed.
Therefore, the desired language should first be set as the language of the website in the general WordPress Core Settings under Settings → General . Since the language is already selected during installation, German should usually already be set.
This will download existing German language files for themes and plugins from WordPress.org. By the way, language files from wordpress.org , as well as themes and plugins, can be kept up to date under Dashboard → Updates .
To create a new translation for a WordPress theme or plugin, a template is required - the aforementioned .pot file. This contains all translatable text phrases in the original language and thus serves as a template for the new language file.
Usually this is provided by the author of the theme / plugin and is already available. Twenty Seventeen, for example, does not use the .pot file because the translation takes place entirely under translate.wordpress.org .
With the Create template option, Loco Translate offers the option of automatically creating the template for the translation.
The plugin reads all text strings from the files of the theme and creates a finished .pot file in the theme folder.
Create a new language file
With the existing template, a new language file can be created by clicking on New language if no translation is available yet.
In addition to selecting the language, the storage location of the language file must be selected.
As a first option, the language file can be saved directly in the theme folder. This is useful for your own (child) themes, where you are the author. For themes from WordPress.org or other providers, I advise against it, because the theme files are overwritten with every update and the language files are thus lost.
The third option / wp-content / languages / is the conventional WordPress Core storage location for translations or language packs from WordPress.org. These are also overwritten when the translations are updated.
If you want to ensure that your own translation is not overwritten by updates, you should therefore choose the second option - saving the language files in / wp-content / languages / loco / . This folder is only used by Loco Translate.
Translate WordPress theme or plugin
You can then start translating the individual text passages in the Translation Editor. The interface is very intuitive and self-explanatory.
The search field, which can be used to filter translations, is very useful. In this way, certain text strings can be found quickly, for example if texts that are only visible in the front end are to be translated.
Loco Translate has many other features that make the plugin very useful:
Existing language files can be copied and cloned with one click. This is particularly useful for changing or expanding existing translations.
Download language files
The translated language files can be downloaded as .po and .mo files at any time in order to make them available to other users. If you want, you can import your translations for themes and plugins from the WordPress.org directory under translate.wordpress.org and make them available to the community.
Synchronize voice files
The .pot file as a template can change with every theme or plugin update. Text phrases are added, changed, or removed. With the sync button of the Loco Translate plugin, all language files can be matched and synchronized with the template at any time.