mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
4842231074
We now use standard framework generatedby "gettextize" utility. It has two limitations which I do not consider sufficiently important to invest into hand-made solution: 1. It can automatically gather strings only from files which have some file extension like .c or .py. Right now we do not have any translatable strings in Python files without extensions. Given that these files will be removed from source tree and replaced with entry points from setuptools I do not see a reason to invest into supporting this. 2. It does not automatically strip untranslated strings from po files. This is a manual step in mainteiner's in workflow anyway so I will add separate Makefile target for it later on. This commit contains gettextize instrastructure + filled-in files Makevars and POTFILES.in. https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Lukas Slebodnik <lslebodn@redhat.com>
106 lines
4.5 KiB
Plaintext
106 lines
4.5 KiB
Plaintext
Q: I've added a new source file, how do I make sure it's strings get translated?
|
|
|
|
A: Add the source file to the POTFILES.in list. 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 in stead 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 and *.po files are used by translators, they must be in SCM so the
|
|
translator can checkout out a .po files, add the translations, and then check
|
|
the .po file back in.
|
|
|
|
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 are automatically generated and thus do not need to be in SCM?
|
|
|
|
A: 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 transation 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 is 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 download fr.po is 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 a object file for run time use.
|
|
|
|
Credits:
|
|
- GNU project
|
|
- John Dennis <jdennis@redhat.com> for his work on the original system
|