General Support - Translating CMA and CMDM (.PO / .MO Files)


Translating CMA and CMDM

Back to User Guide

Methods of Translation

  1. Labels - Simple method, translates from English to another language from the plugin's settings
  2. po/mo files - Advanced method. Present in CM Answers (CMA) and CM Downloads Manager (CMDM)
  3. External Plugins - Advanced method. Uses third-party plugins to achieve multiple translations

Summary

If you use CM Answers or CM Downloads in a localized WordPress installation, you should edit .po/mo files to translate most of the labels.

Introduction 

Two of our most seasoned plugins - CM Answers (CMA) and CM Downloads Manager (CMDM) - have particularities on how to translate labels.

CMA and CMDM also follow the internationalization (i18n) standard (learn more from WordPress) on top of having labels settings in the back-end.

This means the plugins have extra files (.po/.mo) with data for each language.


How Does This Affect Me?

Some CMA and CMDM labels are available in the i18n files and not in the labels settings. In other words, If you use localized WordPress, you should translate labels mostly using the i8n process instead of the usual label settings.

Localized WordPress vs Language Settings

Localized WordPress is a localized WordPress installation. You have localized WordPress if you either:

  • Installed WordPress in a language other than English, or
  • Edited the wp-config.php file and replaced ('WPLANG', 'en_US'); with another language and country code, such as ('WPLANG', 'fr_FR');
Language Settings

It is different from changing the Backend language via the settings


How To Translate?

Requirements

  • An editor such as Poedit (recommended). Or a text editor (we'll use Sublime as example below)
  • FTP access to your site

Step-by-step

1
Open the plugin folder under wp-content → plugins → cm-answers pro or download-manager-pro → lang.

TIP: Creating New Language File

If you are creating a new language file, it is recommended to copy another language's file. This skips a longer process of starting with creating .pot files

Follow the pattern:

2
If you are using Poedit, the file will be opened as a table.

If you are using a text editor, you should find the strings to be translated. They will be located under quotes after "msgid"

3
Edit the translation.

In a text editor, it will be located located after "mgstr", right below "msgstr"

4
Save the .po file. Poedit will automatically generate a related .mo file, which is necessary.

If using a text editor, you can generate the mo file from the po by using online tools such as po2mo.net - web-based po to mo converter
5
Upload both po and mo files to the same folder,  wp-content → plugins → cm-answers pro or download-manager-pro → lang.

Special Case: Plural

There are some instances of labels with singular and plural options in both CMA and CMDM. The editing process is similar: they have one label for each. Example:

Just as before, translate the content between quotes. In this case, %d will be replaced with the relevant number.

# @ cm-answers-pro
#: lib/models/Thread.php:850
#, php-format
msgid "1 second ago"
msgid_plural "%d seconds ago"
msgstr[0] "il y a 1 seconde"
msgstr[1] "il y a %d secondes"
	

CM Downloads Back-end Labels

Note that CM Downloads also has files for back-end settings: cm-download-manager-pro-backend- language code_COUNTRY CODE



WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center