summaryrefslogtreecommitdiffstats
path: root/po/README
blob: 1f1fc3c3e1f8d3eff6aee02356892f4792d0e7ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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