Knowledge Base
  1. Home
  2. Knowledge Base
  3. Advanced Topics
  4. Translating Heroic Plugins (legacy method)

Translating Heroic Plugins (legacy method)

This article is applicable to plugins published before September 2016. Please see the translating Heroic Plugins article for current recommended method.

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.

Copy the file and rename the file with the relevant WordPress locale, for example if you were translating the file into French, rename the file plugin-textdomain-fr_FR.po, where plugin-textdomain is the name of the text domain that the plugin loads. For example Heroic Knowledge Base uses ht-knowledge-base as it’s textdomain, so for a French translation ensure the the translations files are named ht-knowledge-base-fr_FR.po and ht-knowledge-base-fr_FR.po

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-fr_FR.po PO translation file in PO Edit, first click Update to update the translation source.
PO Edit PHP parse
Parsing the php file in PO Edit
  1. Open the Catalog Properties from Catalog > Properties and select the language, select OK.
PO Edit catalog properties
PO Edit catalog properties
  1. Now you can go through the source text and enter your translations.
  2. Click Validate then Save the translations, the PO file will be updated and an MO file will be generated.
  3. Upload the new/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 WordPress localize (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