General Support - Translating CMA and CMDM (.PO / .MO Files)
Translating CMA and CMDM
Methods of Translation
- Labels - Simple method, translates from English to another language from the plugin's settings
- po/mo files - Advanced method. Present in Questions and Answers Plugin (CMA) and Download and File Manager Plugin (CMDM)
- External Plugins - Advanced method. Uses third-party plugins to achieve multiple translations
If you use Questions and Answers plugin or Download and File Manager plugin in a localized WordPress installation, you should edit .po/mo files to translate most of the labels.
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
It is different from changing the Backend language via the settings
How To Translate?
- An editor such as Poedit (recommended). Or a text editor (we'll use Sublime as example below)
- FTP access to your site
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
msgid "1 second ago"
msgid_plural "%d seconds ago"
msgstr "il y a 1 seconde"
msgstr "il y a %d secondes"