NOTE: This is draft documentation and is likely to be unclear and/or incomplete. Please do not hesitate to contact a member of the team for clarification or help on any aspect of translation.
Thank you for taking an interest in open source development! Translating singapore is a matter of editing a single file and then running a script on it. What could be simpler?
Language strings are stored in standard GNU Gettext PO (portable object) files which means you can use all currently available PO editors such as poEdit (or even a simple text editor) to make your translations.
For added convenience strings for each language are split into two sections: one for normal gallery operation and another for strings that are only used in admin mode. This means that admin strings are not needlessly loaded for every page and also that translators have the choice of only translating the standard strings or going the whole way and translating the admin strings too.
It is a good idea for all translators and potential translators to join the development mailing list. Use this and the internationalization forum to interact with other translators and developers.
No further software is required for using the multilanguage capabilities of
singapore. However the extract and merge tools use xgettext and msgmerge
respectively. Both these programs are part of GNU Gettext which is already
installed on most Linux distributions. A package of the relevant gettext
binaries for Windows is available here:
http://singapore.sourceforge.net/binaries/singapore-gettext-Win32.zip.
The path to xgettext is stored in tools/extract.php
and the path to
msgmerge is stored in tools/merge.php
. However if the gettext programs
are in your PATH or in the tools/
directory itself then you do not
need to edit anything.
All language files are kept in a single directory (locale/
by
default). They are named as follows:
singapore.pot
-
untranslated standard language strings template in PO formatsingapore.admin.pot
-
untranslated admin language strings template in PO formatsingapore.LANG.po
-
translated standard language strings in PO formatsingapore.admin.LANG.po
-
translated admin language strings in PO formatsingapore.LANG.pmo
-
translated standard strings as compiled PHP serialized objectsingapore.admin.LANG.pmo
-
translated admin strings as compiled PHP serialized objectwhere LANG
represents the ISO639 langauge code of the chosen
language (e.g. de
for German, en
for English,
en-gb
for English (United Kingdom)). A more comprehensive list of
language codes may be found here:
http://www.rickbull.co.uk/tutorials/HTML/Useful%20Information/language_codes.php
Start by copying a PO template file (singapore.pot
if you
are translating the standard strings or singapore.admin.pot
if you
are translating the admin strings) and naming it appropriately for your language
as described above. Now open the file in your chosen PO editor or a plain text
editor and set about translating the strings.
You also need to fill in certain parts of the PO file header. You may do this at any stage of the translation.
NOTES:
printf()
.
Essentially each %s is a placeholder and so needs to be present at the
appropriate place in the translated string.printf()
. More details on this may be found here:
http://www.php.net/sprintfOnce you have translated all the strings and filled in the header, you need
to compile the PO file into a PHP serialized object file for use with
singapore. Do this using the compile script
provided in the tools/
directory of the singapore distribution.
And that's it!
NOTE: This section is mainly copied from the section 5.2 of the GNU Gettext manual.
The initial comments "SOME DESCRIPTIVE TITLE", "YEAR" and "FIRST AUTHOR <EMAIL@ADDRESS>, YEAR" ought to be replaced by sensible information.
msgmerge
program, as well
as for users whose locale's character encoding differs from yours.
The following encodings are frequently used for the corresponding languages.
ISO-8859-1
for Afrikaans, Albanian, Basque,
Catalan, Dutch, English, Estonian, Faroese, Finnish, French,
Galician, German, Greenlandic, Icelandic, Indonesian, Irish,
Italian, Malay, Norwegian, Portuguese, Spanish, Swedish,ISO-8859-2
for Croatian, Czech, Hungarian,
Polish, Romanian, Serbian, Slovak, Slovenian,ISO-8859-3
for Maltese,ISO-8859-5
for Macedonian, Serbian,ISO-8859-6
for Arabic,ISO-8859-7
for Greek,ISO-8859-8
for Hebrew,ISO-8859-9
for Turkish,ISO-8859-13
for Latvian, Lithuanian,ISO-8859-15
for Basque, Catalan, Dutch, English,
Finnish, French, Galician, German, Irish, Italian, Portuguese,
Spanish, Swedish,KOI8-R
for Russian,KOI8-U
for Ukrainian,CP1251
for Bulgarian, Byelorussian,GB2312
, GBK
, GB18030
for simplified writing of Chinese,BIG5
, BIG5-HKSCS
for traditional
writing of Chinese,EUC-JP
for Japanese,EUC-KR
for Korean,TIS-620
for Thai,UTF-8
for any language, including those listed
above.The character encoding name can be written in either upper or lower case. Usually upper case is preferred.
xgettext
.8bit
.NOTE: This section is mainly copied from the section 10.2.5 of the GNU Gettext manual.
The Plural-forms field in the PO header is used to calculate which plural form of a word to use. In English there are only two plural forms but other languages have only one or as many as four.
Please check the list below to see if your language is listed. If it is then use the corresponding string. If not then you can either write it yourself (details below and in the gettext manual) or email a member of the team describing how your langauge works (e.g. (not real) 0 car, 1-2 cars, 3 caren, 5+ carii) and we will write one for you.
Plural-Forms: nplurals=1; plural=0;
Languages with this property include:
Plural-Forms: nplurals=2; plural=n==1 ? 0 : 1;
Languages with this property include:
Plural-Forms: nplurals=2; plural=n>1;
Languages with this property include:
Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
Languages with this property include:
Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;
Languages with this property include:
Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
Languages with this property include:
Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
Languages with this property include:
Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
Languages with this property include:
Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
Languages with this property include:
The nplurals
value must be a decimal number which
specifies how many different plural forms exist for this
language. The string following plural
is an
expression which is using the C language syntax. Exceptions are
that no negative numbers are allowed, numbers must be decimal,
and the only variable allowed is n
. This expression
will be evaluated whenever one of the plural functions is called.
The numeric value passed to
these functions is then substituted for all uses of the variable
n
in the expression. The resulting value then must
be greater or equal to zero and smaller than the value given as
the value of nplurals
.
$Date: 2003/08/15 20:32:04 $