3 1. Adding a new language:
4 =========================
6 Assuming you have downloaded the distributed source tarball, unpacked it and
7 changed directory to the root directory of the unpacked source tarball first
8 make the po template file:
13 Use the elinks.pot template file as the basis for you translation:
15 $ cp elinks.pot <your language code>.po
17 Modify .po file header that should look like this:
19 # SOME DESCRIPTIVE TITLE.
20 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
21 # This file is distributed under the same license as the PACKAGE package.
22 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
27 "Project-Id-Version: PACKAGE VERSION\n"
28 "POT-Creation-Date: 2005-03-03 11:22+0100\n"
29 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
30 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
31 "Language-Team: LANGUAGE <LL@li.org>\n"
33 "Content-Type: text/plain; charset=CHARSET\n"
34 "Content-Transfer-Encoding: 8bit\n"
35 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
37 Once done don't forget to remove '#, fuzzy' line.
38 Then follow the instructions in the 'Updating .po files' section below.
40 1.1 Integrating a new language file:
41 ------------------------------------
43 When you are done editing the .po file you need to integrate it as part of
44 ELinks. If you don't feel comfortable editing the ELinks C-language source code
45 don't hesitate to get a developer to do it for you.
47 First change directory to the root directory of the unpacked source tarball:
51 Add your language code to the ALL_LINGUAS string in configure.in (keep the
52 alphabetic order ;). To make the change take effect you have to rebuild all
58 The language file will now be compiled when you run make and you can check the
59 translation file for errors and fix any warnings you get.
61 Next thing is to add it to the Setup->Language menu. This is done by adding an
62 entry in the language array in src/intl/gettext/libintl.c, and should not
63 require any C coding skills, just copy an already existing entry and edit the
64 name of your language (in English) so you end up with something like:
66 struct language languages[] = {
71 {"<name for your language in English>", "<your language code>"},
77 1.2 Making the new language file part of ELinks:
78 ------------------------------------------------
80 Finally to make it part of the ELinks distribution send it to one of the
81 mailinglists or file it as a bug at <http://bugzilla.elinks.or.cz>.
84 2. Updating .po files:
85 ======================
90 There are a great deal of tools for editing and working with .po files most are
91 described in the gettext manual availabe at <http://www.gnu.org/manual/gettext>
92 or by typing `info gettext` on some systems. Some editors have special .po modes
93 to help spot errors etc. but nothing fancy is required to update only some
96 In order to compile, get warnings and actually use your updated language file
97 you will however need the gettext tools. If you don't have any of these tools
98 please don't hesitate to still do the update and send it to the mailinglist or
99 bugzilla so it can be added to CVS. By next release or nightly generated tarball
100 you can then make use of your updates.
102 2.2 The basics of updating:
103 ---------------------------
105 2.2.1 Singular forms, general rules:
106 ------------------------------------
108 Each string that needs to be translated will look like this:
110 #: src/dialogs/info.c:184
112 msgid "Cache content: %s"
113 msgstr "Cacheindhold: %s"
115 Lines starting with '#' are comments or control hints for the po compiler. The
116 text following '#:' is a listing of each place (filename and line number) in the
117 code where the string is used. Text following '#,' are a comma separated list of
122 means that the string was changed in the code and the translator
123 needs to check if the translation is still ok. When it has been
124 checked or updated it is safe to remove 'fuzzy' and the
129 is a hint to the compiler, checker and translator that the
130 string uses printf format.
132 The string following 'msgid' are the original untranslated string. It is used to
133 get the translated one so: DO NEVER CHANGE IT. If you spot an error in it change
134 it in the code instead and resync your .po files using make update-po.
136 The string following 'msgstr' is the translated string.
137 TODO: write about the meaning of % fragments.
139 Some strings contain '~' (tilde) chars. They are used to mark hotkeys in text
140 for menu entries. The char following the '~' is the hotkey char. So in the
141 string "Global ~history" the hotkey will become 'h'. You should try and keep
142 hotkeys unique. If you configure ELinks with --enable-debug conflicting hotkeys
145 Some translations may become obsolete due to code modifications, these will be
146 marked by #~ prefix, and moved at end of file. Keeping them may be a good thing
147 since a modification can be reversed later and then gettext tools will reuse
148 these special lines at resync time. If, at some time, you think some of these
149 lines will never be reused, feel free to delete them to reduce file size.
151 A special msgid ("") contains .po file headers, you may update them as
152 well, especially Last-Translator and PO-Revision-Date fields.
157 First set Plural-Forms: header (msgid "" at top of .po file) to some correct
158 value, depending on language.
160 To help you in this, here is an excerpt from GNU gettext documentation:
163 Some languages only require one single form. There is no distinction
164 between the singular and plural form. An appropriate header entry
165 would look like this:
167 Plural-Forms: nplurals=1; plural=0;
169 Languages with this property include:
178 Two forms, singular used for one only:
179 This is the form used in most existing programs since it is what English
180 is using. A header entry would look like this:
182 Plural-Forms: nplurals=2; plural=n != 1;
184 (Note: this uses the feature of C expressions that boolean expressions
185 have to value zero or one.)
187 Languages with this property include:
190 Danish, Dutch, English, German, Norwegian, Swedish
198 Italian, Portuguese, Spanish
202 Two forms, singular used for zero and one:
203 Exceptional case in the language family. The header entry would be:
205 Plural-Forms: nplurals=2; plural=n>1;
207 Languages with this property include:
210 French, Brazilian Portuguese
212 Three forms, special case for zero:
213 The header entry would be:
215 Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
217 Languages with this property include:
222 Three forms, special cases for one and two:
223 The header entry would be:
225 Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;
227 Languages with this property include:
232 Three forms, special case for numbers ending in 1[2-9]:
233 The header entry would look like this:
235 Plural-Forms: nplurals=3; \
236 plural=n%10==1 && n%100!=11 ? 0 : \
237 n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
239 Languages with this property include:
244 Three forms, special cases for numbers ending in 1 and 2, 3, 4,
245 except those ending in 1[1-4]:
246 The header entry would look like this:
248 Plural-Forms: nplurals=3; \
249 plural=n%10==1 && n%100!=11 ? 0 : \
250 n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
252 Languages with this property include:
255 Croatian, Czech, Russian, Slovak, Ukrainian
257 Three forms, special case for one and some numbers ending in 2, 3, or 4:
258 The header entry would look like this:
260 Plural-Forms: nplurals=3; \
262 n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
264 Languages with this property include:
269 Four forms, special case for one and all numbers ending in 02, 03, or 04:
270 The header entry would look like this:
272 Plural-Forms: nplurals=4; \
273 plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
275 Languages with this property include:
281 More info at http://www.gnu.org/software/gettext
284 Plural forms will appear like this in .po file:
286 #: src/dialogs/info.c:259
289 msgid_plural "%d sessions"
290 msgstr[0] "%d session"
291 msgstr[1] "%d sessions"
293 msgid and msgid_plural should not be changed, each msgstr[n] line contains
294 translation for each plural form.
297 2.3 Synchronizing .po files with the code
298 -----------------------------------------
300 IMPORTANT: if you changed strings in the code, or if you're using a cvs version
301 of ELinks, take care of synchronization between code and po files. Before any
302 change to a po file, you must synchronize it with code.
304 To update only one file you may use:
306 cd po/ ; make update-po PO=<lang>.po
310 cd po/ ; make update-po PO=<lang>
312 where <lang> has to be replaced by ie. fr, de, da, cs...
314 If this fails or you want to update all .po files, use:
316 cd po/ ; make update-po
318 2.4 Checking updated .po files
319 ------------------------------
321 After updating a .po file you should always check it for errors in the c-format
322 fragments, etc. You can do this by running:
324 cd po/ ; make check-po PO=<lang>.po
328 cd po/ ; make check-po PO=<lang>
330 It can potentially report some false positives if the .po file contains fuzzy
333 2.5 Making the updates part of ELinks:
334 --------------------------------------
336 If the language file is already added finally run make to compile and check the
337 language file for errors and fix any warnings you get. Then patch your changes
338 and send it to one of the mailinglists or file it as a bug at
339 <http://bugzilla.elinks.or.cz>.
345 Some people (like Zas but other mortals as well ;) like to know how much of the
346 language file is up-to-date. This can be accomplished by running the
347 gen_translations_stats.sh script from the po/ directory. It will list the
348 current status of each language file. Be proud if your language file rank higher
349 or the same as the French one.
352 $Id: README,v 1.9 2005/03/03 10:48:00 zas Exp $