root/CPS3/products/CPSI18n/trunk/doc/howto-translate_cps.txt

Revision 53034, 10.1 kB (checked in by madarche, 8 months ago)

Removing any remaining traces specifying that PO files should be filled with
Latin characters and not UTF8, since it is not the case anymore.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 =====================
2 CPS Translation HOWTO
3 =====================
4
5 :Authors: - Stefane Fermigier
6           - Marc-Aurèle Darche
7
8 :Revision: $Id$
9
10 :Abstract: This document gives some background information and tips
11     on translating CPS .po files.
12
13 .. sectnum::    :depth: 4
14 .. contents::   :depth: 4
15
16
17 Each CPS product has an i18n directory containing all pot/po files
18 plus some others. All of them should be translated.
19
20
21 Definitions
22 ===========
23
24 PO file (.po file): PO stands for "Portable Object". PO files
25 contain sets of strings which associate each translatable string
26 with its translation in a particular language. A single PO file
27 relates to only one language. A PO file is derived from a POT file
28 and is edited either by hand or using KBabel.
29
30 POT file (.pot file): POT stands for "Portable Object Template". A
31 POT file is built by extracting all the translatable strings from
32 application source files. A POT file does not contain translations
33 into any particular language. It is used by the translators as a
34 template.
35
36 Message ID: msgid is the keyword which introduces the original
37 string in a PO file. It is followed by a C-like string that spans
38 one or more lines.
39
40 Message String: msgstr is the keyword which introduces the
41 translated string in PO file. It is followed by C-like string that
42 spans on one or multiple lines.
43
44 Fuzzy translation: This is a flag generated, in general, by
45 msgmerge. It shows that a msgstr string might not be a correct
46 translation. The translator must see and make modifications to the
47 string if necessary and then remove the "fuzzy" flag from the
48 message's comment.
49
50 See:
51
52 - http://docs.kde.org/en/3.3/kdesdk/kbabel/glossary.html
53
54 - http://www.debian.org/doc/manuals/intro-i18n/
55
56
57 Files
58 =====
59
60 - ``.config_pot``: Holds the name of the pot file which contains all
61   strings.
62
63 - ``.blacklist_pot``: Holds the path to pot files from other
64   products so that you can use their msgids without having them
65   duplicated in your own pot file. Put a relative path per line.
66
67 - ``custom.pot``: Contains dynamic strings which i18n tools can't
68   extract automatically: text inside Python modules or scripts,
69   text generated into scripts or templates...
70
71
72 Adding a new translation to CPS
73 ===============================
74
75 Use the `Codes for the Representation of Names of Languages`
76 http://www.loc.gov/standards/iso639-2/php/code_list.php
77 to determine which language code to use for naming your files.
78
79 To start your translation, make a copy of the master pot file.
80 (This copy must be named according to i18n rules: en.po or
81 en_US.po and not EN.po, en_us.po or en-US.po. Case and underscore
82 are important.)
83
84 Next, add your language in CPSDefault's custom.pot file. There's a
85 Languages paragraph and the msgid will be like
86 ``label_language_en_US``.
87
88 Then add your language to the language vocabulary defined in
89 ``CPSDocument/skins/cps_document/getDocumentVocabularies.py`` if
90 you use CPS < 3.4.  For CPS >= 3.4, do the same in
91 ''CPSDefault/profiles/default/vocabularies/language_voc.xml''.
92 There are three keys to add: the first one is the i18n label, the
93 same that you used to name your po file; the second one is how you
94 name your language in your own language -- note how some strings
95 are not to be translated; the third one is the msgid you used in
96 CPSDefault's custom.pot file, it will be used when the vocabulary
97 gets translated.
98
99 If you use CPS < 3.4, you will also need to modify the file
100 ``CPSDefault/zmi/manage_addCPSSiteForm.dtml``. If you use CPS >= 3.4,
101 then do the same in ``CPSDefault/factory.py``.  There's a Languages
102 box which contains a list of two element tuples. Add a new tuple
103 for your language. The first element will be the i18n label and
104 the second your language name in English.
105
106 Now you can start translating message strings. You should use
107 dedicated tools and should not handle it by hand so you will
108 avoid most common mistakes.
109
110 How to have CPS reread the translation files
111 --------------------------------------------
112
113 For CPS 3.4 and subsequent versions
114 +++++++++++++++++++++++++++++++++++
115
116 Updating the translations from the translation files can be done through the
117 `portal_setup` tool (located at the root of your CPS instance in the `ZMI`) by
118 importing the needed steps from the `Import` tab, but before that you need to add
119 your language code to the `available_languages` property of your CPS site
120 (`Property` tab of your CPS instance in the `ZMI`).
121
122 If the translations you are doing only affect the CPSDefault, CPSSchemas,
123 CPSDocument, CPSDirectory, CPSNavigation, CPSPortlets, and CPSSkins products,
124 then you need to import the `Localizer` step from the `CPS Default Site`
125 profile::
126
127   portal_setup -> Import -> Select Localizer -> Select CPS Default Site -> Import selected steps
128
129 If the translations you are doing also affect other products you will need, just
130 the same, to select the profile for each of these products and import their
131 `Localizer` step.
132
133 Alternatively one can also use the old way (read the next section) but it may
134 not be working anymore anytime.
135
136 For CPS prior to CPS 3.4
137 ++++++++++++++++++++++++
138
139 Updating the translations from the translation files can be done through an
140 external method.  Go to the `ZMI` and select the `i18n Updater` (located at the
141 root of the CPS instance). Then select the `Test` tab.
142
143 If this external method does not exist you may try to create it with the
144 following parameters::
145
146   Id: i18n Updater
147   Title: i18n Updater
148   Module Name: CPSDefault.cpsinstall
149   Function Name: cps_i18n_update
150
151
152 Zope 3 non persistent i18n system
153 +++++++++++++++++++++++++++++++++
154
155 Some CPS producst use the new Zope 3 non persistent i18n system. That is the
156 case of the CPSSharedCalendar product.
157
158 For products using the Zope 3 non persistent i18n system, messages are located
159 in ``Products/PRODUCT_NAME/locales/``. After editing the `po` files you should
160 compile them as follows ::
161
162   $ msgfmt -o file.mo file.po
163
164 Thus for CPSSharedCalendar, edit the files in
165 ``Products/CPSSharedCalendar/locales`` and then after editing the `po` files
166 compile them as follows ::
167
168   $ msgfmt -o cpscalendar.mo cpscalendar.po
169
170 Then you have to restart Zope to see your modifications applied. There is no
171 need to rerun the profiles.
172
173
174 How to contribute your translation or translation updates
175 =========================================================
176
177 Open up a ticket in trac https://svn.nuxeo.org/trac/pub/newticket
178 with "i18n" as keyword and your translations bundled in a TAR GZ or ZIP
179 archive as a file attachment.
180
181 You can use the account tracguest/tracguest if you haven't an account already.
182
183
184 Software
185 ========
186
187 KBabel runs under any Unix flavor where KDE is ported, which
188 includes Cygwin for Windows.
189
190 Xemacs has a po mode, hard to use, but very useful.
191
192 GTranslator: Runs under any Unix flavor where Gnome is ported.
193
194 poEdit: Runs under Linux and Windows (http://poedit.sourceforge.net/).
195
196
197 Online tools
198 ============
199
200 Automatic translations could be useful to recall a few vocabulary
201 items, if you don't have a dictionary (either paper or online), but
202 do NOT use them for translating a whole sentence: they won't do
203 your job as well as yourself!
204
205 Google's language tools: http://www.google.com/language_tools
206
207 Babelfish: http://babelfish.altavista.com/babelfish/tr
208
209 InterTran translation: http://www.tranexp.com:2000/Translate/result.shtml
210
211 Grand dictionnaire terminologique (French/English/Latin technical
212 terms): http://granddictionnaire.com/btml/fra/r_motclef/index800_1.asp
213
214 Acronym Finder: http://www.acronymfinder.com/
215
216 Cambridge Dictionaries online: http://dictionary.cambridge.org/
217
218 Dictionary.com: http://www.dictionary.com/
219
220
221 Good practices
222 ==============
223
224 First, be sure you use the most up-to-date .po files. That is, make sure that
225 you are getting the .po files from the last CPS release source archive or,
226 better, that you are using them from a fresh SVN checkout
227 http://svn.nuxeo.org/trac/pub/browser/ . The rationale is that the files on
228 which you are working have certainly been modified (and sometimes fixed) since
229 they have been released or that you have downloaded them, even if you are an
230 official translator for a given language. This is because we use an automatic
231 updater on all .po files.
232
233 Never add a string outside custom.pot files. It would break
234 our updater, and consequently delay the addition of your po files.
235 For the same reason, do not use Localizer to export your files.
236
237 Look at the context. The best way is to check where msgids appear
238 in the site, then look at the msgid context in the product (po
239 files and skins). If you have doubts, you can, in this order,
240 check en.po, check another po file that you understand, then ask
241 the CPS translators list <cps-translators@lists.nuxeo.com>.
242
243 Once your translation is done and uploaded into CPS, test it
244 against non-technical people, which are the common audience for
245 CPS. This is necessary to make sure you don't use terms that are
246 too technical or too abstract.
247
248 If you are in doubt about another translation you are using for
249 inspiration, ask the mailing list so you can contact the upstream
250 translator or people speaking that language.
251
252
253 General rules
254 =============
255
256 Action names or page title:
257
258 - Modify/Modification not Edit/Edition
259
260 - Delete not Erase
261
262 Form actions (buttons):
263
264 - (button_change) Save changes not Modify/Change/Validate
265
266 - (button_apply)  Apply not Change/View
267
268 - (button_update) Update for a pop-up that update a field not Save
269
270 - button_change not button_edit
271
272 - (button_delete) Delete not Erase
273
274 Others:
275
276 - e-mail not mail/email
277
278 - metadata not meta-data
279
280 If you want to add or fix something in this document, please join
281 the list of CPS translators <cps-translators@lists.nuxeo.com>.
282
283
284 Translation coverage
285 ====================
286
287 The translation coverage for CPS 3.3.8 and the current developments (trunk) are
288 respectively
289 http://www.cps-project.org/static/i18n/CPS-3.3.8/i18n_coverage.png ,
290 http://www.cps-project.org/static/i18n/CPS-trunk/i18n_coverage.png
291
292 If you want to produce those graphs yourself you need to use the i18n_coverage
293 script from the CPSI18n product and the gdchart python program (on Debian Sarge
294 apt-get install python-gdchart libgdchart-gd1-noxpm).
295
296 And here is a possible command line::
297
298   $ CPSI18n/bin/i18n_coverage -v --dir
299   /usr/local/zope/instance/cps-zope2.9/Products CPS* Cal* -eCPSSkins
300
301
302 .. Local Variables:
303 .. mode: rst
304 .. End:
305 .. vim: set filetype=rst:
Note: See TracBrowser for help on using the browser.