2010-02-09 12:14:25 -06:00
|
|
|
Q: I've added a new source file, how do I make sure it's strings get translated?
|
|
|
|
|
2016-11-14 07:53:42 -06:00
|
|
|
A: Run config.status in top-level directory and then run "make ipa.pot-update".
|
2012-06-20 05:38:16 -05:00
|
|
|
|
2010-02-09 12:14:25 -06:00
|
|
|
Q: How do I pick up new strings to translate from the source files after the
|
|
|
|
source have been modified?
|
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
A: make ipa.pot-update
|
2010-02-09 12:14:25 -06:00
|
|
|
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?
|
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
A: make ipa.pot-update
|
2012-06-20 05:38:16 -05:00
|
|
|
|
2010-02-09 12:14:25 -06:00
|
|
|
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
|
2010-09-24 19:48:23 -05:00
|
|
|
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
|
2010-09-28 16:27:01 -05:00
|
|
|
However, if this line is wrong, it is often an indicator that the locale
|
|
|
|
value is incorrect. For example, using 'jp' for Japanese in stead of 'ja'
|
2012-06-20 05:38:16 -05:00
|
|
|
will result in an invalid Plurals line.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
|
|
|
Q: What files must be under source code control?
|
|
|
|
|
|
|
|
A: The files Makefile.in, LINGUAS control the build, they must be in the SCM.
|
2016-11-14 07:53:42 -06:00
|
|
|
The *.pot file contains list of translatable strings and can be re-generated
|
|
|
|
at any time from program sources, so is 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.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
|
|
|
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
|
2016-11-11 15:54:13 -06:00
|
|
|
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.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
|
|
|
Q: Which are automatically generated and thus do not need to be in SCM?
|
|
|
|
|
2016-11-14 07:53:42 -06:00
|
|
|
A: *.pot files are automatically generated from program sources.
|
|
|
|
The *.gmo files are automatically generated on demand from their
|
2016-11-11 15:54:13 -06:00
|
|
|
corresponding .po file.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
|
|
|
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
|
2016-11-11 15:54:13 -06:00
|
|
|
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
|
2010-02-09 12:14:25 -06:00
|
|
|
regenerate the .pot file in order to pick up the new string.
|
2016-11-11 15:54:13 -06:00
|
|
|
This template file needs to be uploaded from time to time to translation
|
|
|
|
service so translators can translate new and updated strings incrementally.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
|
|
|
Q: What is the relationship between a .po file and the .pot file?
|
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
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.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
Q: What is the transation workflow?
|
2010-02-09 12:14:25 -06:00
|
|
|
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").
|
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
2) Maintainer produces the .pot file by running make ipa.pot-update.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
3) .pot file contains one msgid, "Begin".
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
4) Maintainer uploads .pot file is to Zanata translation service:
|
|
|
|
$ zanata-cli push
|
|
|
|
(all the parameters are taken from zanata.xml file)
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
5) Translator uses Zanata service to provide the French translation
|
|
|
|
of "Begin".
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
5) Maintainer download fr.po is generated by Zanata service,
|
|
|
|
it also contains one msgid, "Begin".
|
|
|
|
$ zanata-cli pull
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
6) Maintainer strips untranslated strings from .po files
|
|
|
|
to make diffs smaller:
|
|
|
|
$ make strip-po
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
7) Maintainer commits new .po files to Git.
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
Q: What are .gmo files?
|
2010-02-09 12:14:25 -06:00
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
A: .gmo files are the content of a .po file but in "machine" format for fast
|
2010-02-09 12:14:25 -06:00
|
|
|
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 a object file for run time use.
|
|
|
|
|
2016-11-11 15:54:13 -06:00
|
|
|
Credits:
|
|
|
|
- GNU project
|
|
|
|
- John Dennis <jdennis@redhat.com> for his work on the original system
|