Recent: resize to "Title" column contents
[nomnom.git] / doc / HowtoTranslate.txt
blob4bfc7ae54a9cfe0841aa495d5e851d1666ea4732
2 HOWTO: Translate NomNom
3 =======================
5 Prerequisites
6 -------------
8 Make sure you have installed Qt development libraries with with the Qt
9 tools (e.g. qmake, linguist, lupdate and lrelease). See the INSTALL file
10 in the nomnom top source directory for the other prerequisites that nomnom
11 depends on.
13 Before you get started
14 ----------------------
16 Get the latest version of nomnom from:
17   http://nomnom.sourceforge.net/
19 Please *do not* use the development code from nomnom git repository as
20 it is subject to frequent changes.
22   tar xf nomnom-$release.tar.* ; cd nomnom-$release
23   mkdir tmp ; cd tmp
24   ../configure ; make
26 The translation subsystem of nomnom supports the following environment
27 settings:
29  * N_QM_SHOW_SCANDIR ;# display the scanned (for .qm files) dirs
30  * N_QM_SHOW         ;# display the found .qm files
32  Example: env N_QM_SHOW_SCANDIR=1 N_QM_SHOW=1 ./src/nomnom
34 The subsystem picks the system locale setting and tries to match it to
35 one of the found .qm files. If one is found, the .qm is loaded.
37 The default language (English) is built-in and is does not have a
38 string to identify it. If nothing was matched to the existing .qm files,
39 the subsystem defaults to English.
41 Please note that some elements of nomnom cannot be translated as they
42 are part of the core system of Qt. Examples of this are the standard
43 buttons seen in many of the dialogs. Make sure you have installed the Qt
44 library translations along with the rest of the Qt and that your system
45 locale is set to the appropriate value, e.g.:
47   env LANG=de_DE.UTF-8 ./src/nomnom
50 Key accelerators
51 ----------------
53 Please make sure you set accelerators so that they are not in conflict
54 with one another. For example, instead of two widgets using the same
55 (e.g. Alt+F) use a different combination for the other so that they
56 do not interfere with one another.
59 Untranslatable strings
60 ----------------------
62   * GPLv3+ license found in About / License
63     These are the contents of the COPYING file
66 Creating a new .ts file
67 =======================
69 The translations exist in .ts files, you can read more about them here:
70   http://doc.qt.nokia.com/latest/internationalization.html
72 We will use a wrapper script ("gen-tr.sh") to handle the .ts files in the
73 following examples. If you are interested, have a look at the script for
74 the essentials.
76 Getting started
77 ---------------
79 Let's assume you are going to create the French translation for nomnom.
80 These examples assume that you have created the 'tmp' VPATH as described
81 in the "Before you get started" above.
83   cd nomnom-$release                    ;# cd to the top source dir
84   ./gen-tr.sh -n tr/NomNom_fr_FR.ts     ;# create the French .ts
85   linguist tr/NomNom_fr_FR.ts           ;# translate using linguist
87 Once you have gone over all of the translatable strings, exit linguist
88 and run:
90   cd tmp                                ;# cd to 'tmp' dir
91   ../gen-tr.sh -r ../tr/NomNom_fr_FR.ts ;# produce .qm file
92   cp ../tr/NomNom_fr_FR.qm tr/          ;# cp .qm to $top_srcdir/tmp/tr/
93   env LANG=fr_FR.UTF-8 ./src/nomnom     ;# assumes "language=" in config
95 Note that the last step does not have to include the LANG setting.
97 It is possible to use the linguist application (File / Release) for the
98 same effect that of running "gen-tr.sh -r".
100 You should now be able to choose the language from the application
101 settings.
104 Updating an existing translation
105 ================================
107 The steps are very similar to the ones above. Let's assume you have
108 noticed that the existing French translation is missing some of the
109 new strings introduced in a later version of nomnom.
111   cd nomnom-$release                ;# cd to top source dir
112   ./gen-tr.sh -u                    ;# this updates all existing .ts files
113   linguist tr/NomNom_fr_FR.ts       ;# edit the update .ts
114   mkdir tmp ; cd tmp                ;# cd to 'tmp' dir
115   ../configure ; make               ;# build nomnom
116   ./src/nomnom
118 The "make" produces the updated .qm file initially. If you, however,
119 edit the ../tr/NomNom_fr_FR.ts file after this, you have to:
121   (edit ../tr/NomNom_fr_FR.ts)
122   ../gen-tr.sh -r ../tr/NomNom_fr_FR.ts ;# produce .qm file
123   cp ../tr/NomNom_fr_FR.qm tr/          ;# cp .qm to $top_srcdir/tmp/tr/
125 This is because the current Makefiles do not track the .ts files for
126 changes.
128 Once you have (re)generated the .qm, you can:
130   env LANG=fr_FR.UTF-8 ./src/nomnom     ;# assumes "language=" in config
132 See the notes above about LANG and choosing the language from the
133 dialog.
136 Contributing .ts to the project
137 ===============================
139 If you would like to contribute your .ts (new or updated) to the project,
140 please open a new ticket at:
141   http://sourceforge.net/apps/trac/nomnom ;# you will need sf account
143 We can then add the .ts to the nomnom dist. Thanks!