77 -------------------- |
77 -------------------- |
78 |
78 |
79 Using GIS features |
79 Using GIS features |
80 ------------------ |
80 ------------------ |
81 |
81 |
|
82 .. _howto-i18n: |
|
83 |
82 Internationalization |
84 Internationalization |
83 -------------------- |
85 -------------------- |
84 .. _howto-i18n: |
|
85 |
86 |
86 pot-create -o ref.pot scr/ |
87 Internationalization is the process of developing your plugin so it can easily be translated into other languages |
87 msgmerge -U def.po ref.pot |
88 It's called also i18n (because there are 18 letters between the i and the n) |
88 msgfmt def.po |
|
89 |
89 |
90 #bin/pot-create -o src/onf_website/locales/onf_website.pot src/ |
90 Introduction to Gettext |
91 #msgmerge -U --previous --sort-by-file src/onf_website/locales/fr/LC_MESSAGES/onf_website.po src/onf_website/locales/onf_website.pot |
91 ^^^^^^^^^^^^^^^^^^^^^^^ |
92 #msgfmt src/onf_website/locales/fr/LC_MESSAGES/onf_website.po -o src/onf_website/locales/fr/LC_MESSAGES/onf_website.mo |
92 |
|
93 For i18n **gettext** libraries and tools is widely used in the open-source world. |
|
94 |
|
95 Here is how it works in a few sentences: |
|
96 |
|
97 Developers wrap translatable strings in special gettext functions |
|
98 Special tools parse the source code files and extract the translatable strings into POT (Portable Objects Template) files. |
|
99 Translators translate the strings and the result is a PO file (POT file, but with translations inside) |
|
100 PO files are compiled to binary MO files, which give faster access to the strings at run-time |
|
101 |
|
102 |
|
103 In source code the _() function which refers to the native gettext-compliant translation function. |
|
104 |
|
105 PyAMS help us to generated this translation file with the tool *pot-create*: |
|
106 |
|
107 |
|
108 .. code-block:: shell |
|
109 |
|
110 pot-create -o ref.pot <path/to/sources> |
|
111 |
|
112 |
|
113 Example to update PyAMS package: |
|
114 |
|
115 .. code-block:: shell |
|
116 |
|
117 #bin/pot-create -o src/<package>/locales/.pot src/ |
|
118 #msgmerge -U --previous --sort-by-file src/<package>/locales/fr/LC_MESSAGES/ref.po src/<package>/locales/ref.pot |
|
119 #msgfmt src/<package>/locales/fr/LC_MESSAGES/ref.po -o src/<package>/locales/fr/LC_MESSAGES/ref.mo |