...
Continuing from our above example, in backup.po you will see several "msgid" and "msgstr" name/value pairs. "msgid" contains the string to be translated and "msgstr" will be where you put your translation for the given "msgid". Here's an example from the core module where we translate "Delete Route %s" to Spanish:
Code Block |
---|
#: amp_conf/htdocs/admin/modules/core/page.routing.php:275
#: amp_conf/htdocs/admin/modules/core/page.did.php:141
#, php-format
msgid "Delete Route %s"
msgstr "Agregar Usuario %s" |
|
If you are working in Linux there is a PO-editor called KBabel which you may prefer to use. Otherwise you may also want to check out the cross-platform (Linux/Mac/Windows) editor called Poedit.
...
Note: If you are using KBabel or Poedit, the files are compiled with these programs and you don't have to do the next part
Code Block |
---|
msgfmt -v <module>.po -o <module>.mo |
|
For example, you have translated the backup.po, to compile it, run:
Code Block |
---|
msgfmt -v backup.po -o backup.mo |
|
You might have some errors to correct, which are usually a result of quoting problems or that you have not updated the header in the .po file. If you have no error and all is good, continue to the next step.
...
/var/www/html/admin/views/menu.php
Code Block |
---|
if($amp_conf['SHOWLANGUAGE']) {
$out .= '<a id="language-menu-button" '
. 'class="button-right ui-widget-content ui-state-default">' . _('Language') . '</a>';
$out .= '<ul id="fpbx_lang" style="display:none;">';
$out .= '<li data-lang="en_US"><a href="#">'. _('English') . '</a></li>';
$out .= '<li data-lang="bg_BG"><a href="#">' . _('Bulgarian') . '</a></li>';
$out .= '<li data-lang="zh_CN"><a href="#">' . _('Chinese') . '</a></li>';
$out .= '<li data-lang="de_DE"><a href="#">' . _('German') . '</a></li>';
$out .= '<li data-lang="fr_FR"><a href="#">' . _('French') . '</a></li>';
$out .= '<li data-lang="he_IL"><a href="#">' . _('Hebrew') . '</a></li>';
$out .= '<li data-lang="hu_HU"><a href="#">' . _('Hungarian') . '</a></li>';
$out .= '<li data-lang="it_IT"><a href="#">' . _('Italian') . '</a></li>';
$out .= '<li data-lang="pt_PT"><a href="#">' . _('Portuguese') . '</a></li>';
$out .= '<li data-lang="pt_BR"><a href="#">' . _('Portuguese (Brasil)') . '</a></li>';
$out .= '<li data-lang="ru_RU"><a href="#">' . _('Russian') . '</a></li>';
$out .= '<li data-lang="sv_SE"><a href="#">' . _('Swedish') . '</a></li>';
$out .= '<li data-lang="es_ES"><a href="#">' . _('Spanish') . '</a></li>';
$out .= '</ul>';
} |
|
Once you've located the code block, you'll want to add you code to above the line that shows:
Code Block |
---|
$out .= '</ul>'; |
|
For example, if you want to add Danish as the new language, you would add the following live above the code block above:
Code Block |
---|
$out .= '<li data-lang="da_DK"><a href="#">' . _('Danish') . '</a></li>'; |
|
Finally you can test your translations by refreshing your browser window and selecting your new language. If everything looks good, zip up your translated <modules>.po and <modules.>mo files and submit them by creating a New Ticket in our bug tracker. For information on how to do that, please see FreePBX Ticket Reporting.
Determining Translation Status
...