Rev Author Line No. Line
228 kaklik 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3  
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <title>singapore - Translation</title>
7 <link rel="stylesheet" type="text/css" href="docstyle.css" />
8 </head>
9  
10 <body>
11  
12 <h1>singapore - Translation</h1>
13  
14 <ul>
15 <li><a href="#intro">Introduction</a></li>
16 <li><a href="#requirements">Requirements</a></li>
17 <li><a href="#update">Updating a translation</a></li>
18 <li><a href="#new">Starting a new translation</a></li>
19 <li><a href="#header">Filling in the header section</a></li>
20 <li><a href="#plurals">Plural forms</a></li>
21 <li><a href="#links">Useful links</a></li>
22 <li><a href="Readme.html">General readme</a></li>
23 <li><a href="Advanced.html">Advanced features</a></li>
24 <li><a href="Development.html">Developer documentation</a></li>
25 </ul>
26  
27  
28 <h2><a name="intro">Introduction</a></h2>
29  
30 <p>Thank you for taking an interest in open source development!
31 Translating singapore is a matter of editing a single file and
32 then running a script on it. What could be simpler?</p>
33  
34 <p>Language strings are stored in standard GNU Gettext PO (portable object)
35 files which means you can (at least in theory <a href="#foot1" name="note1"><sup>1</sup></a>)
36 use all currently available PO editors such as
37 <a href="http://poedit.sourceforge.net/">poEdit</a> to make your
38 translations.</p>
39  
40 <p>For added convenience strings for each language are split into two sections:
41 one for normal gallery operation and another for strings that are only used in
42 admin mode. This means that admin strings are not needlessly loaded for every
43 page and also that translators have the choice of only translating the standard
44 strings or going the whole way and translating the admin strings too.</p>
45  
46 <p>It is a good idea for all translators and potential translators to join the
47 <a href="http://lists.sourceforge.net/lists/listinfo/singapore-devel">development
48 mailing list</a>. Use this, the
49 <a href="http://singapore.sourceforge.net/forum/viewforum.php?f=6">internationalisation forum</a>
50 and the
51 <a href="http://sourceforge.net/tracker/?atid=611769&group_id=77687">translations tracker</a>
52 to interact with other translators and developers.</p>
53  
54 <p class="boxed"><a href="#note1" name="foot1">1</a>The reason for the "in theory"
55 is that many PO editors do not support the plural forms that singapore makes use
56 of - even though they are defined and supported by GNU Gettext. poEdit does
57 support plural forms since v1.3 and is highly recommended. Alternatively it is
58 just as easy to use a standard text editor to make your translations.</p>
59  
60 <h2><a name="requirements">Requirements</a></h2>
61  
62 <p>No further software is required for using the multilanguage capabilities of
63 singapore. However the extract and merge tools use xgettext and msgmerge
64 respectively. Both these programs are part of GNU Gettext which is already
65 installed on most Linux distributions. A package of the relevant gettext
66 binaries for Windows is available here:
67 <a href="http://singapore.sourceforge.net/binaries/singapore-gettext-Win32.zip">http://singapore.sourceforge.net/binaries/singapore-gettext-Win32.zip</a>.
68 The path to xgettext is stored in <code>tools/extract.php</code> and the path to
69 msgmerge is stored in <code>tools/merge.php</code>. However if the gettext programs
70 are in your PATH or in the <code>tools/</code> directory itself then you do not
71 need to edit anything.</p>
72  
73  
74 <h2><a name="update">Updating a translation</a></h2>
75  
76 <p>Each singapore release requires the language files to be updated slightly.
77 First make sure you have the latest available translation (the
78 <a href="http://sourceforge.net/tracker/?atid=611769&group_id=77687">translations tracker</a>
79 is a good place to check for this). Now you need to merge in the new untranslated
80 strings and remove the obsolete ones (this may have already been done
81 but there's no harm in doing it again). Place the old PO file in the locale
82 directory of an installation of the latest version of singapore and use the
83 <a href="../tools/merge.php">merge</a> script provided.</p>
84  
85 <p>Now proceed translating the strings as described below. Finally, attach the
86 updated PO file to the appropriate tracker item making sure to state which
87 version of singapore it is for.</p>
88  
89  
90 <h2><a name="new">Starting a new translation</a></h2>
91  
92 <p>The very first thing to do is submit a tracker item on the
93 <a href="http://sourceforge.net/tracker/?atid=611769&group_id=77687">translations tracker</a>
94 to inform people of your intentions so that two or more people do not needlessly
95 spend time translating the same files for the same language. Once you have
96 completed your translations you can attach the files to the tracker item.</p>
97  
98 <p>All language files are kept in a single directory (<code>locale/</code> by
99 default). They are named as follows:</p>
100  
101 <ul>
102 <li><code>singapore.pot</code> -
103 untranslated standard language strings template in PO format</li>
104 <li><code>singapore.admin.pot</code> -
105 untranslated admin language strings template in PO format</li>
106 <li><code>singapore.<em>LANG</em>.po</code> -
107 translated standard language strings in PO format</li>
108 <li><code>singapore.admin.<em>LANG</em>.po</code> -
109 translated admin language strings in PO format</li>
110 <li><code>singapore.<em>LANG</em>.pmo</code> -
111 translated standard strings as compiled PHP serialized object</li>
112 <li><code>singapore.admin.<em>LANG</em>.pmo</code> -
113 translated admin strings as compiled PHP serialized object</li>
114 </ul>
115  
116 <p>where <code><em>LANG</em></code> represents the ISO639 language code of the chosen
117 language (e.g. <code>de</code> for German, <code>en</code> for English,
118 <code>en-gb</code> for English (United Kingdom)). A more comprehensive list of
119 language codes may be found here:
120 <a href="http://www.rickbull.co.uk/tutorials/HTML/Useful%20Information/language_codes.php">http://www.rickbull.co.uk/tutorials/HTML/Useful%20Information/language_codes.php</a></p>
121  
122 <p>Start by copying a PO template file (<code>singapore.pot</code> if you
123 are translating the standard strings or <code>singapore.admin.pot</code> if you
124 are translating the admin strings) and naming it appropriately for your language
125 as described above. Now open the file in your chosen PO editor or a plain text
126 editor and set about translating the strings.</p>
127  
128 <p>You also need to fill in certain parts of the <a href="#header">PO file
129 header</a>. You may do this at any stage of the translation.</p>
130  
131 <p>NOTES:</p>
132  
133 <ol>
134 <li>Strings in the form "crumb line|You are here:"<br />
135 In these cases the text up to and including the vertical bar, |, should NOT
136 be included in the translation. They are simply hints for the translator.</li>
137  
138 <li>Strings in the form "Showing %s-%s of %s"<br />
139 In these cases each %s will be replaced at runtime by a number or string in
140 order from left to right according to the rules of <code>printf()</code>.
141 Essentially each %s is a placeholder and so needs to be present at the
142 appropriate place in the translated string.<br />
143 However some languages may require the order of the arguments to be changed.
144 For example if instead of "Showing 1-10 of 15" you want to say
145 "Out of 15 objects 1-10 are shown" then you must use the argument swapping
146 syntax of <code>printf()</code>. More details on this may be found here:
147 <a href="http://www.php.net/sprintf">http://www.php.net/sprintf</a></li>
148  
149 <li>Strings with plurals<br />
150 You must correctly specify the <a href="#plurals">Plural-forms</a> header field
151 in order to make use of plural forms. Put each plural in its own
152 <code>msgstr[<em>x</em>]</code> where x is a number between 0 (inclusive) and
153 the nplurals number you specified in the header (see examples below).</li>
154  
155 <li>Using a text-editor<br />
156 When translating an entry you must leave the English language strings
157 (those on lines starting <code>msgid</code>) untouched and insert the
158 translated strings between the double-quotes on the following lines (those
159 starting <code>msgstr</code> or <code>msgstr[<em>x</em>]</code> in the case of
160 plurals).</li>
161  
162 <li>Obsolete entries<br />
163 When updating a PO file, obsolete entries (i.e. those strings which appeared
164 in the previous version but do not in the current version) are placed at the
165 end of the PO file and prepended by <code>#~</code>. There is no need to
166 translate these entries as they are ignored by the compiler.</li>
167 </ol>
168  
169 <p>Once you have translated all the strings and filled in the header, you need
170 to compile the PO file into a PHP serialized object file for use with
171 singapore. Do this using the <a href="../tools/compile.php">compile</a> script
172 provided in the <code>tools/</code> directory of the singapore distribution.</p>
173  
174 <p>And that's it!</p>
175  
176 <p>Now go and attach your translated PO file(s) to the tracker item you created
177 before starting the translation so that everyone else can make use of it.</p>
178  
179 <h2>Examples</h2>
180  
181 <p>The following string
182 <pre class="boxed">
183 # File: ../includes/singapore.class.php, line: 247
184 #, c-format
185 msgid "Page created in %s seconds"
186 msgstr ""
187 </pre>
188 when translated into French becomes
189 <pre class="boxed">
190 # File: ../includes/singapore.class.php, line: 247
191 #, c-format
192 msgid "Page created in %s seconds"
193 msgstr "Page créée en %s secondes"
194 </pre>
195  
196 and the following string
197 <pre class="boxed">
198 # File: ../includes/admin.class.php, line: 173
199 msgid "admin bar|Edit image"
200 msgstr ""
201 </pre>
202 when translated into Italian becomes
203 <pre class="boxed">
204 # File: ../includes/admin.class.php, line: 173
205 msgid "admin bar|Edit image"
206 msgstr "Modifica l'immagine"
207 </pre>
208  
209 and the following string
210 <pre class="boxed">
211 # File: ../includes/singapore.class.php, line: 530
212 #, c-format
213 msgid "%s gallery"
214 msgid_plural "%s galleries"
215 msgstr[0] ""
216 </pre>
217 when translated into Spanish becomes
218 <pre class="boxed">
219 # File: ../includes/singapore.class.php, line: 530
220 #, c-format
221 msgid "%s gallery"
222 msgid_plural "%s galleries"
223 msgstr[0] "%s galería"
224 msgstr[1] "%s galerías"
225 </pre>
226  
227 </p>
228  
229 <h2><a name="header">Filling in the header section</a></h2>
230  
231 <p class="note">NOTE: This section is mainly copied from the
232 <a href="http://www.gnu.org/manual/gettext/html_chapter/gettext_5.html#SEC35">section 5.2</a>
233 of the GNU Gettext manual.</p>
234  
235 <p>The initial comments "SOME DESCRIPTIVE TITLE", "YEAR" and
236 "FIRST AUTHOR &lt;EMAIL@ADDRESS&gt;, YEAR" ought to be replaced by
237 sensible information.</p>
238  
239 <h3>The following fields must be filled in correctly:</h3>
240  
241 <dl>
242 <dt>Content-Type</dt>
243 <dd>Replace <samp>ISO-8859-1</samp> with the
244 character encoding used for your language, in your locale, or
245 UTF-8. This field is needed for correct operation of the
246 <code>msgmerge</code> program, as well
247 as for users whose locale's character encoding differs from yours.
248  
249  
250 <p>The following encodings are frequently used for the corresponding
251 languages.</p>
252  
253 <ul>
254 <li><code>ISO-8859-1</code> for Afrikaans, Albanian, Basque,
255 Catalan, Dutch, English, Estonian, Faroese, Finnish, French,
256 Galician, German, Greenlandic, Icelandic, Indonesian, Irish,
257 Italian, Malay, Norwegian, Portuguese, Spanish, Swedish,</li>
258  
259 <li><code>ISO-8859-2</code> for Croatian, Czech, Hungarian,
260 Polish, Romanian, Serbian, Slovak, Slovenian,</li>
261  
262 <li><code>ISO-8859-3</code> for Maltese,</li>
263  
264 <li><code>ISO-8859-5</code> for Macedonian, Serbian,</li>
265  
266 <li><code>ISO-8859-6</code> for Arabic,</li>
267  
268 <li><code>ISO-8859-7</code> for Greek,</li>
269  
270 <li><code>ISO-8859-8</code> for Hebrew,</li>
271  
272 <li><code>ISO-8859-9</code> for Turkish,</li>
273  
274 <li><code>ISO-8859-13</code> for Latvian, Lithuanian,</li>
275  
276 <li><code>ISO-8859-15</code> for Basque, Catalan, Dutch, English,
277 Finnish, French, Galician, German, Irish, Italian, Portuguese,
278 Spanish, Swedish,</li>
279  
280 <li><code>KOI8-R</code> for Russian,</li>
281  
282 <li><code>KOI8-U</code> for Ukrainian,</li>
283  
284 <li><code>CP1251</code> for Bulgarian, Byelorussian,</li>
285  
286 <li><code>GB2312</code>, <code>GBK</code>, <code>GB18030</code>
287 for simplified writing of Chinese,</li>
288  
289 <li><code>BIG5</code>, <code>BIG5-HKSCS</code> for traditional
290 writing of Chinese,</li>
291  
292 <li><code>EUC-JP</code> for Japanese,</li>
293  
294 <li><code>EUC-KR</code> for Korean,</li>
295  
296 <li><code>TIS-620</code> for Thai,</li>
297  
298 <li><code>UTF-8</code> for any language, including those listed
299 above.</li>
300 </ul>
301  
302 <p>The character encoding name can be written in either upper or
303 lower case. Usually upper case is preferred.</p>
304 </dd>
305  
306 <dt>Plural-Forms</dt>
307 <dd>See the <a href="#plurals">plural forms</a> section.</dd>
308  
309 </dl>
310  
311 <h3>The following fields should be filled in:</h3>
312  
313 <dl>
314 <dt>Project-Id-Version</dt>
315 <dd>This is the name and version of the package.</dd>
316  
317 <dt>Last-Translator</dt>
318 <dd>Fill in your name and email address (without double
319 quotes).</dd>
320  
321 <dt>Language-Team</dt>
322 <dd>Fill in the English name of the language followed by the native name
323 of the language in brackets. E.g. <i>"Language-Team: German (Deutsch)\n"</i><br />
324 Note this is different from the GNU specification but is required in order
325 for the language flipper function to work.
326 </dd>
327 </dl>
328  
329 <h3>The following fields may be left alone:</h3>
330  
331 <dl>
332 <dt>POT-Creation-Date</dt>
333 <dd>This has already been filled in by <code>xgettext</code>.</dd>
334  
335 <dt>PO-Revision-Date</dt>
336 <dd>You don't need to fill this in. It should be filled by the editor when
337 you save the file.</dd>
338  
339 <dt>Content-Transfer-Encoding</dt>
340 <dd>Set this to <code>8bit</code>.</dd>
341 </dl>
342  
343 <h2><a name="plurals">Plural forms</a></h2>
344  
345 <p class="note">NOTE: This section is mainly copied from the
346 <a href="http://www.gnu.org/manual/gettext/html_chapter/gettext_10.html#SEC150">section 10.2.5</a>
347 of the GNU Gettext manual.</p>
348  
349  
350 <p>The Plural-forms field in the PO header is used to calculate which plural
351 form of a word to use. In English there are only two plural forms but other
352 languages have only one or as many as four.</p>
353  
354 <p>Please check the list below to see if your language is listed. If it is
355 then use the corresponding string. If not then you can either write it yourself
356 (details below and in the gettext manual) or email a member of the team
357 describing how your langauge works (e.g. (not real) 0 car, 1-2 cars, 3 caren, 5+ carii)
358 and we will write one for you.
359  
360 <dl>
361 <dt>Only one form:</dt>
362 <dd>Some languages only require one single form. There is no
363 distinction between the singular and plural form. An appropriate
364 header entry would look like this:
365 <pre>Plural-Forms: nplurals=1; plural=0;</pre>
366 <p>Languages with this property include:</p>
367  
368 <dl>
369 <dt>Finno-Ugric family</dt>
370 <dd>Hungarian</dd>
371  
372 <dt>Asian family</dt>
373 <dd>Japanese, Korean</dd>
374  
375 <dt>Turkic/Altaic family</dt>
376 <dd>Turkish</dd>
377 </dl>
378 </dd>
379  
380 <dt>Two forms, singular used for one only</dt>
381 <dd>This is the form used in most existing programs since it is
382 what English is using. A header entry would look like this:
383 <pre>Plural-Forms: nplurals=2; plural=n==1 ? 0 : 1;</pre>
384  
385 <p>Languages with this property include:</p>
386 <dl>
387 <dt>Germanic family</dt>
388 <dd>Danish, Dutch, English, German, Norwegian, Swedish</dd>
389  
390 <dt>Finno-Ugric family</dt>
391 <dd>Estonian, Finnish</dd>
392  
393 <dt>Latin/Greek family</dt>
394 <dd>Greek</dd>
395  
396 <dt>Semitic family</dt>
397 <dd>Hebrew</dd>
398  
399 <dt>Romanic family</dt>
400 <dd>Italian, Portuguese, Spanish</dd>
401  
402 <dt>Artificial</dt>
403 <dd>Esperanto</dd>
404 </dl>
405 </dd>
406  
407 <dt>Two forms, singular used for zero and one</dt>
408 <dd>Exceptional case in the language family. The header entry would be:
409 <pre>Plural-Forms: nplurals=2; plural=n&gt;1;</pre>
410  
411 <p>Languages with this property include:</p>
412  
413 <dl>
414 <dt>Romanic family</dt>
415 <dd>French, Brazilian Portuguese</dd>
416 </dl>
417 </dd>
418  
419 <dt>Three forms, special case for zero</dt>
420 <dd>The header entry would be:
421 <pre>Plural-Forms: nplurals=3; plural=n%10==1 &amp;&amp; n%100!=11 ? 0 : n != 0 ? 1 : 2;</pre>
422  
423 <p>Languages with this property include:</p>
424  
425 <dl>
426 <dt>Baltic family</dt>
427 <dd>Latvian</dd>
428 </dl>
429 </dd>
430  
431 <dt>Three forms, special cases for one and two</dt>
432 <dd>The header entry would be:
433 <pre>Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;</pre>
434  
435 <p>Languages with this property include:</p>
436  
437 <dl>
438 <dt>Celtic</dt>
439 <dd>Gaeilge (Irish)</dd>
440 </dl>
441 </dd>
442  
443 <dt>Three forms, special case for numbers ending in 1[2-9]</dt>
444 <dd>The header entry would look like this:
445 <pre>Plural-Forms: nplurals=3; plural=n%10==1 &amp;&amp; n%100!=11 ? 0 : n%10&gt;=2 &amp;&amp; (n%100&lt;10 || n%100&gt;=20) ? 1 : 2;</pre>
446  
447 <p>Languages with this property include:</p>
448  
449 <dl>
450 <dt>Baltic family</dt>
451 <dd>Lithuanian</dd>
452 </dl>
453 </dd>
454  
455 <dt>Three forms, special cases for numbers ending in 1 and 2, 3,
456 4, except those ending in 1[1-4]</dt>
457  
458 <dd>The header entry would look like this:
459 <pre>Plural-Forms: nplurals=3; plural=n%10==1 &amp;&amp; n%100!=11 ? 0 : n%10&gt;=2 &amp;&amp; n%10&lt;=4 &amp;&amp; (n%100&lt;10 || n%100&gt;=20) ? 1 : 2;</pre>
460 <p>Languages with this property include:</p>
461  
462 <dl>
463 <dt>Slavic family</dt>
464 <dd>Croatian, Czech, Russian, Slovak, Ukrainian</dd>
465 </dl>
466 </dd>
467  
468 <dt>Three forms, special case for one and some numbers ending in
469 2, 3, or 4</dt>
470  
471 <dd>The header entry would look like this:
472 <pre>Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10&gt;=2 &amp;&amp; n%10&lt;=4 &amp;&amp; (n%100&lt;10 || n%100&gt;=20) ? 1 : 2;</pre>
473 <p>Languages with this property include:</p>
474  
475 <dl>
476 <dt>Slavic family</dt>
477 <dd>Polish</dd>
478 </dl>
479 </dd>
480  
481 <dt>Four forms, special case for one and all numbers ending in
482 02, 03, or 04</dt>
483  
484 <dd>The header entry would look like this:
485 <pre>Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;</pre>
486 <p>Languages with this property include:</p>
487  
488 <dl>
489 <dt>Slavic family</dt>
490 <dd>Slovenian</dd>
491 </dl>
492 </dd>
493 </dl>
494  
495 <h3>How the Plural-forms header works:</h3>
496  
497 <p>The <code>nplurals</code> value must be a decimal number which
498 specifies how many different plural forms exist for this
499 language. The string following <code>plural</code> is an
500 expression which is using the C language syntax. Exceptions are
501 that no negative numbers are allowed, numbers must be decimal,
502 and the only variable allowed is <code>n</code>. This expression
503 will be evaluated whenever one of the plural functions is called.
504 The numeric value passed to
505 these functions is then substituted for all uses of the variable
506 <code>n</code> in the expression. The resulting value then must
507 be greater or equal to zero and smaller than the value given as
508 the value of <code>nplurals</code>.</p>
509  
510 <h2><a name="links">Useful links</a></h2>
511  
512 <ul>
513 <li><a href="http://singapore.sourceforge.net/forum/viewforum.php?f=6">singapore i18n forum</a></li>
514 <li><a href="http://www.gnu.org/software/gettext/">GNU Gettext homepage</a></li>
515 <li><a href="http://www.gnu.org/manual/gettext/">GNU Gettext manual</a> - lots
516 of technical information about the PO format</li>
517 <li><a href="http://poedit.sourceforge.net/">poEdit</a> - an open source cross-platform PO editor</li>
518 <li><a href="http://www.gtranslator.org/">gTranslator</a> - a PO editor for GNOME</li>
519 <li><a href="http://i18n.kde.org/tools/kbabel/">KBabel</a> - a PO editor for KDE</li>
520 </ul>
521  
522  
523 <p><em>$Date: 2004/11/01 08:17:33 $</em></p>
524  
525 </body>
526 </html>