Q: I've added a new source file, how do I make sure it's strings get translated?

A: Run config.status in top-level directory and then run "make ipa.pot-update".

Q: How do I pick up new strings to translate from the source files after the
   source have been modified?

A: make ipa.pot-update
   This regenerates the pot template file by scanning all the source files.
   Then the new strings are merged into each .po file from the new pot file.

Q: How do I just regenerate the pot template file without regenerating all the
   .po files?

A: make ipa.pot-update

Q: How do I add a new language for translation?

A: Edit the LINGUAS file and add the new language. Then run "make create-po".
   This will generate a new .po file for each language which doesn't have one
   yet. Be sure to add the new .po file(s) to the source code repository.  For
   certain languages, you may have to edit the Plurals line.  See:
   http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
   However, if this line is wrong, it is often an indicator that the locale
   value is incorrect.  For example, using 'jp' for Japanese instead of 'ja'
   will result in an invalid Plurals line.

Q: What files must be under source code control?

A: The files Makefile.in, LINGUAS control the build, they must be in the SCM.
   The *.pot file contains list of translatable strings and can be re-generated
   at any time from program sources, so it does not need to be in SCM.
   *.po files contain snapshot of translated strings so they must be in SCM
   for the case where translation service we use goes down.

   Be careful, .po files may be automatically updated when the source files
   change (or the .pot changes, usually the .pot file changes only as a result
   of rescanning the source files). This mean a .po file might be automatically
   updated while a file from translation service is being downloaded.

   If there is a conflict, you should generate new pot file,
   upload it do the translation service, and re-download the po files.

Q: Which files are automatically generated and thus do not need to be in SCM?

A: *.pot files are automatically generated from program sources.
   The *.gmo files are automatically generated on demand from their
   corresponding .po file.

Q: What role does the .pot file play?

A: The .pot file is called a template file. It is generated by scanning all the
   source files (e.g. *.py *.c *.h) in the project using xgettext. xgettext
   locates every translatable string (e.g. strings marked with _()) and adds
   that string along with metadata about it's location to the .pot file. Thus
   the .pot file is a collection of every translatable string in the project.
   If you edit a source file and add a translatable string you will have to
   regenerate the .pot file in order to pick up the new string.
   This template file needs to be uploaded from time to time to translation
   service so translators can translate new and updated strings incrementally.

Q: What is the relationship between a .po file and the .pot file?

A: A .po file contains the translations for particular language. It derives
   from the .pot file. When the .pot file is updated with new strings
   to translate each .po will merge the new strings in.
   Previously the .po file was where translators worked providing translations
   for their language.
   Today the work is done inside translation service Zanata so the .po files
   are kept in SCM just for the case of failure in the translation service.

Q: What is the translation workflow?
   Let's use an example for French, it's .po file will be fr.po.

   1)  Developer creates main.c with one translatable sting _("Begin").

   2)  Maintainer produces the .pot file by running make ipa.pot-update.

   3)  .pot file contains one msgid, "Begin".

   4)  Maintainer uploads .pot file to Zanata translation service:
       $ zanata-cli push
       (all the parameters are taken from zanata.xml file)

   5)  Translator uses Zanata service to provide the French translation
       of "Begin".

   5)  Maintainer downloads fr.po as generated by Zanata service,
       it also contains one msgid, "Begin".
       $ zanata-cli pull

   6)  Maintainer strips untranslated strings from .po files
       to make diffs smaller:
       $ make strip-po

   7)  Maintainer commits new .po files to Git.

Q: What are .gmo files?

A: .gmo files are the content of a .po file but in "machine" format for fast
   run time access (mo = Machine Object, po = Portable Object). .mo files are
   what gets installed along with the package. Think of a .po as a source file
   which is compiled into an object file for run time use.

Credits:
- GNU project
- John Dennis <jdennis@redhat.com> for his work on the original system
