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 Testing your changes without installing ELinks:
78 ---------------------------------------------------
80 It is possible to test translation updates without installing ELinks. After
81 building both ELinks and the po files, simply start ELinks from the top-level
82 directory in the source tree using:
86 It will then load po files from the po/ directory in the source tree.
88 1.3 Making the new language file part of ELinks:
89 ------------------------------------------------
91 Finally to make it part of the ELinks distribution send it to one of the
92 mailinglists or file it as a bug at <http://bugzilla.elinks.cz>.
95 2. Updating .po files:
96 ======================
101 There are a great deal of tools for editing and working with .po files most are
102 described in the gettext manual availabe at <http://www.gnu.org/manual/gettext>
103 or by typing `info gettext` on some systems. Some editors have special .po modes
104 to help spot errors etc. but nothing fancy is required to update only some
107 In order to compile, get warnings and actually use your updated language file
108 you will however need the gettext tools. If you don't have any of these tools
109 please don't hesitate to still do the update and send it to the mailinglist or
110 bugzilla so it can be added to Git. By next release or nightly generated tarball
111 you can then make use of your updates.
113 2.2 The basics of updating:
114 ---------------------------
116 2.2.1 Singular forms, general rules:
117 ------------------------------------
119 Each string that needs to be translated will look like this:
121 #: src/dialogs/info.c:184
123 msgid "Cache content: %s"
124 msgstr "Cacheindhold: %s"
126 Lines starting with '#' are comments or control hints for the po compiler. The
127 text following '#:' is a listing of each place (filename and line number) in the
128 code where the string is used. Text following '#,' are a comma separated list of
133 means that the string was changed in the code and the translator
134 needs to check if the translation is still ok. When it has been
135 checked or updated it is safe to remove 'fuzzy' and the
140 is a hint to the compiler, checker and translator that the
141 string uses printf format.
143 The string following 'msgid' are the original untranslated string. It is used to
144 get the translated one so: DO NEVER CHANGE IT. If you spot an error in it change
145 it in the code instead and resync your .po files using make update-po.
147 The string following 'msgstr' is the translated string.
148 TODO: write about the meaning of % fragments.
150 Some strings contain '~' (tilde) chars. They are used to mark hotkeys in text
151 for menu entries. The char following the '~' is the hotkey char. So in the
152 string "Global ~history" the hotkey will become 'h'. You should try and keep
153 hotkeys unique. If you configure ELinks with --enable-debug conflicting hotkeys
156 Some translations may become obsolete due to code modifications, these will be
157 marked by #~ prefix, and moved at end of file. Keeping them may be a good thing
158 since a modification can be reversed later and then gettext tools will reuse
159 these special lines at resync time. If, at some time, you think some of these
160 lines will never be reused, feel free to delete them to reduce file size.
162 A special msgid ("") contains .po file headers, you may update them as
163 well, especially Last-Translator and PO-Revision-Date fields.
168 First set Plural-Forms: header (msgid "" at top of .po file) to some correct
169 value, depending on language. See GNU gettext documentation for details, at
170 http://www.gnu.org/software/gettext
172 Plural forms will appear like this in .po file:
174 #: src/dialogs/info.c:259
177 msgid_plural "%d sessions"
178 msgstr[0] "%d session"
179 msgstr[1] "%d sessions"
181 msgid and msgid_plural should not be changed, each msgstr[n] line contains
182 translation for each plural form.
185 2.3 Synchronizing .po files with the code
186 -----------------------------------------
188 IMPORTANT: if you changed strings in the code, or if you're using a Git version
189 of ELinks, take care of synchronization between code and po files. Before any
190 change to a po file, you must synchronize it with code.
192 To update only one file you may use:
194 cd po/ ; make update-po PO=<lang>.po
198 cd po/ ; make update-po PO=<lang>
200 where <lang> has to be replaced by ie. fr, de, da, cs...
202 If this fails or you want to update all .po files, use:
204 cd po/ ; make update-po
206 2.4 Checking updated .po files
207 ------------------------------
209 After updating a .po file you should always check it for errors in the c-format
210 fragments, etc. You can do this by running:
212 cd po/ ; make check-po PO=<lang>.po
216 cd po/ ; make check-po PO=<lang>
218 It can potentially report some false positives if the .po file contains fuzzy
221 Note: It will in some situations report a false-positive. The only currently
222 known issue is when the msgid contains a tilde not being used a an accelerator
223 mark (e.g. "~/.elinks") and the translated msgstr do not.
225 2.5 Making the updates part of ELinks:
226 --------------------------------------
228 If the language file is already added finally run make to compile and check the
229 language file for errors and fix any warnings you get. Then patch your changes
230 and send it to one of the mailinglists or file it as a bug at
231 <http://bugzilla.elinks.cz>.
237 Some people (like Zas but other mortals as well ;) like to know how much of the
238 language file is up-to-date. This can be accomplished by running the
239 gen_translations_stats.sh script from the po/ directory. It will list the
240 current status of each language file. Be proud if your language file rank higher
241 or the same as the French one.