Translating Heroic Plugins

This article reflects the new translation method, if you have an older plugin, please see the legacy plugin translation guide.

Our plugins are translation ready. To translate the themes or plugins you need to copy and edit the PO file contained in the languages folder of the theme and plugins on your site.

Ensure all the theme or plugin folder of the translation target is on your local machine before starting the translation. Do not edit them on a remote server or PO Edit cannot scan and parse the translation strings correctly.

 

Using a program such as PO Edit (http://poedit.net/), you can edit the translations directly, with the following steps, outlined below:

  1. Open the ht-knowledge-base.pot translation template file in PO Edit, and click Create new translation to select a language file to create.
Translating the Heroic Knowledge Base plugin into another language
Translating the Heroic Knowledge Base plugin into another language
  1. Now you can go through the source text and enter your translations. Be sure that for any translations that have plural terms, you enter the singular and plural forms.
Provide a translation for each of the strings you wish to translate
Provide a translation for each of the strings you wish to translate
  1. Click Validate then File > Save As. Save the PO file as the name of the POT with the correct locale code appended. This becomes the translation template for that language. eg. ht-knowledge-base-de_DE.mo, for a German translation.
The naming convention of the .mo files is based on the ISO-639 language code (e.g. pt for Portuguese) followed by the ISO-3166 country code (e.g. _PT for Portugal or _BR for Brazil). So, the Brazilian Portuguese file would be called pt_BR.mo, and a non-specific Portuguese file would be called pt.mo. Complete lists of codes can be found at (country codes) and (language codes).
  1. Click File > Compile to MO to compile the completed translation file, save in the same format, but with a .mo extension.
  2. Upload the newly created / updated language files to your WordPress installation, to the relevant lang or languages folder in the relevant plugin. In the case of the knowledge base plugin, place the MO and PO files in wp-content/plugins/ht-knowledge-base/languages
Translated plugin files
An example of how the files may look in a translated theme directory

 

Set your WordPress language from Settings > General > Site Language. Alternatively a plugin such as WPML can manage the translations for you.

helpguru-lang-translation-4.0-lang-settings-fr

For additional support and guidance with translations, refer to the Translating WordPress on the WordPress Codex.

Was this article helpful?

Related Articles