 | L10n Team internal docs
This page is mostly for the I18n/L10n Team use. |
Updating the POT file
To update the POT (template) file, from the directory containing the checked-out repository (trunk, branches/v1.1, etc.) do the following:
$ bin/extractor.php > l10n/pot/LC_MESSAGES/civicrm.pot
Updating a PO file (merging POT into PO)
If we have a regenerated POT file, we need to migrate the new additions to different languages' PO files. This is done by merging the POT's changes into the PO file; in the below example we update the PO file in place:
$ msgmerge -vU l10n/pl_PL/LC_MESSAGES/civicrm.po l10n/pot/LC_MESSAGES/civicrm.pot
Or, for all languages:
$ for i in l10n/??_??/LC_MESSAGES; do msgmerge -vU $i/civicrm.po l10n/pot/LC_MESSAGES/civicrm.pot; done
After this step, the PO file contains new strings from the POT file either as new positions (i.e., untranslated), or (if the strings are similar to something that was in the PO file earlier) 'intelligently translated' by gettext and marked as 'fuzzy'.
The strings that were in the PO file before the merge, but are not longer present in the POT file (i.e., got 'retired' from CiviCRM) are not deleted, but commented out and moved to the bottom of the PO file. This serves both future translators (how was this translated earlier?) and the gettext's algorithm for 'intelligent translations'.
Updating a MO file (recompiling PO into MO)
Gettext does not use the PO files directly - the PO files have to be compiled into MO binaries. This is done with the following command (as before, this shows how to change the MO file in place):
$ msgcat l10n/pl_PL/LC_MESSAGES/*.po | msgfmt -vo l10n/pl_PL/LC_MESSAGES/civicrm.mo -
Or, for all languages:
$ for i in l10n/??_??/LC_MESSAGES; do msgcat $i/*.po | msgfmt -vo $i/civicrm.mo -; done
Synchronising the repository with Pootle
Currently, we allow everyone to help us in translating CiviCRM by using our Pootle installation. This means that we have to somehow coordinate not only updating the PO files from new POT templates (when the CiviCRM strings change), but also updating the PO files in repository with the ones updated by Pootle users.
The current strategy if as follows ([local] denotes a local machine, [salix] denotes the Pootle-hosting server) - please remember to work on the Pootle-hosting server as the pootle user:
- [local] regenerate the POT file (via bin/extractor.php)
- [local] commit the POT file to the repository
- [salix] stop Pootle
- [salix] check out the POT file from the repository
- [salix] update the PO files from the POT (via msgmerge) for all languages
- [salix] rebuild the MO files from the PO files (via msgcat and msgfmt) for all languages
- [salix] commit the regenerated PO and MO files to the repository
- [salix] start Pootle