1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
<chapter id="translation">
<chapterinfo>
<authorgroup>
<author>
<firstname>J.</firstname>
<surname>Rundholz</surname>
</author>
</authorgroup>
</chapterinfo>
<title>Translation</title>
<para>
This chapter should give any one (in particular people who are not developers) a first overview on how they can translate &app; into another language. The information given here is not only valid for &app; but as serves for the translation of any KDE project.
</para>
<sect1 id="files">
<title>Basics</title>
<para>
First of all you need to get the required files. There are two types of files which might be of interest to you.
Files ending in <literal role="extension">.pot</literal> and files ending
in <literal role="extension">.po</literal>.
</para>
<para>
Files ending in <literal role="extension">.pot</literal> are the source
for the translation.
They only contain the English texts you need to translate and are generated
for each release of the project. The one for &app; is named <filename>kmymoney2.pot</filename>.
The po file contains the English and the translated text, e.g. German.
There might be two cases: The first case you can't find a po file for your
language or the second there is already a po file for your language available.
In the latter case you can already start &app; in your language, but may be the
translation is not complete or you simply want to improve the translation.
Now you need to get these files from the project's &cvs; repository.
You don't need to worry what exactly &cvs; does, for a translater it
is more or less only a file system from where
you can download the files you need. For &app; you can either go to the &cvs;
page and call the &cvs; web front end or follow
<ulink url="http://kmymoney2.cvs.sourceforge.net/kmymoney2/kmymoney2/po/?pathrev=rel-0-8-branch">this link</ulink>.
I would recommend to download the pot and po file of the latest stable version
(at the moment 0.8), not any older files and not the one which is under
development at the moment. In order to test your translation later you should
run the same version on your box.
For the actual translation I recommend the program <application>kbabel</application>.
Other people use <application>emacs</application>, as usual it is just a personal
choice. All examples given here are based on <application>kbabel</application>.
</para>
<sect2 id="po-file">
<title>How to get your po file</title>
<para>
As explained earlier the actual translation is done by modifying the po file.
The next step is to create a po file to start the translation.
</para>
<sect3 id="no-po">
<title>No po file for my language available</title>
<para>
That's the most simple case: Rename <filename>kmymoney2.pot</filename> to
<filename><emphasis>lang</emphasis>.po</filename> where <emphasis>lang</emphasis>
is your language code e.g. <emphasis>de</emphasis> for German.
</para>
</sect3>
<sect3 id="po">
<title>po file for my language available</title>
<para>
In case you already have a language file it is advisable that you check how
the English text entries in that file differ from the English texts in the
pot file. Maybe for some reason the pot file is further developed than the
po file. In this case even though you would translate the whole po file you
would still see some English texts in &app;. If you know that this is not
the case, i.e. your po file has all the latest English text inside, you can
use this one for translation. The minimum check you should perform is to
compare the number of messages. Just load the po and the pot file into kbabel
and you see how many messages you have in each file.
</para>
<para>
In case that both files differ you should merge them (since
you don't want to lose someone else's work). Merging can be
done using <application>kbabel</application> very easily .
<itemizedlist>
<listitem>
<para>
Copy <filename>kmymoney2.pot</filename> to <filename>lang-new.po</filename>
and open this file with <application>kbabel</application>.
</para>
</listitem>
<listitem>
<para>
In <application>kbabel</application> choose
<guimenu>
Tools
<guimenuitem>Rough translation</guimenuitem>
</guimenu>
from the menu. A dialog pops up. Choose the following options:
<itemizedlist>
<listitem><para>What to translate::Untranslated Entries</para></listitem>
<listitem><para>Options::Mark changed entries as fuzzy</para></listitem>
<listitem><para>Dictionaries::Use::PO Compendium</para></listitem>
</itemizedlist>
Don't select anything else.
</para>
</listitem>
<listitem>
<para>
Now press the "configure" button. In the next dialog enter the path to your
already existing po file. Furthermore set the options:
<itemizedlist>
<listitem><para>Options::Case sensitive</para></listitem>
<listitem><para>A text matches if::Equal to searched text</para></listitem>
</itemizedlist>
Don't select anything else.
</para>
</listitem>
</itemizedlist>
<caution>
The original po file could have entries marked as "fuzzy", that means that
the translation might be not very good or even horribly wrong. After you
did this merger process you lose this information. It might be a good
idea to translate all fuzzy strings in the old, unmerged po file before
you do this explained merging process.
</caution>
</para>
</sect3>
</sect2>
</sect1>
<sect1 id="translating">
<title>Translating</title>
<para>
Now you can take the new po file and start the translation with kbabel
or any other tool. It might be a good idea to create a glossary of terms
whenever you use a technical term. Such a glossary is available for the
German translation, check it out to see how it should look like. You might
want to check the gnucash project if they have already a glossary for your
language. This would be a starting point for you, but please extend it.
</para>
</sect1>
<sect1 id="testing">
<title>Test your work</title>
<para>
Last but not least you need to check your translation, especially if the
translated text fits into the context. Also you shouldn't be surprised
how many typos and mistakes you make while translating the text. Check
it carefully! Now a few steps you should perform to test your translation
(after you used a spellchecker etc.).
</para>
<para>
First you can run the command
<screen>
<prompt>thb:~> </prompt><userinput><command>msgcat</command> <option>--width=77</option> <option>-o</option> <replaceable>lang-output.po</replaceable> <replaceable>lang-input.po</replaceable></userinput>
</screen>
as root. This command just restricts the length of each line to 77
characters. This is only necessary if you want to read the raw po file in
some text editor. Some people who do proof reading prefer this instead of
endless lines. The number of characters depends of some personal taste. I
prefer about 50 characters per line, then a diff file can be displayed
without vertical scrolling.
</para>
<para>
Now run as root the command
<screen>
<prompt>thb:~> </prompt><userinput><command>msgfmt</command> <option>-vvv</option> <replaceable>lang.po</replaceable> kmymoney2.mo</userinput>
</screen>
The mo file is the language file you need for your program. You just need
to replace the original mo file of &app; with this one (perform a backup of
the original file before). The location of your mo file depends on your
distro, for SuSE it is <filename>/opt/trinity/share/local/lang/LC_MESSAGES</filename> and for Debian
<filename>/usr/share/local/lang/LC_MESSAGES</filename>. For lang you can use
any string, like de or even de_test if you want to run it with a test
language. Be aware that &app; uses some text strings from KDE and since they
are probably not available with de_test you still might see some English
text. If you can't find the file on your harddrive try either
<screen>
<prompt>thb:~> </prompt><userinput><command>find</command> / <option>-name</option> kmymoney2.mo</userinput>
</screen>
as root or if you used an <command>rpm</command> file for the
installation you can run
<screen>
<prompt>thb:~> </prompt><userinput><command>rpm</command> <option>-q kmymoney2</option> <option>--filesbypkg</option></userinput>
</screen>
</para>
<para>
In order to run &app; either start it as usual (if your default KDE language
is the language you want to test) or call it via
<screen>
<prompt>thb:~> </prompt><userinput>KDE_LANG=de <command>kmymoney2</command></userinput>
</screen>
from a <application>konsole</application> or
<application>xterm</application>.
</para>
</sect1>
<sect1 id="merging">
<title>Merging an old po file with an updated pot file</title>
<para>
There are cases when the pot file is regenerated before you can send your
updated po file. If you just commit your file after that, it will show up
as old in the translation stats, because it references an outdated pot file.
</para>
<para>
To fix this, you have to merge the po file with the updated pot file.
First, get the latest pot file. And in the po folder, run this command.
<screen>
<prompt>thb:~/kmymoney2/po> </prompt><userinput><command>make</command> <option>-f</option> <option>../admin/Makefile.common</option> <option>package-merge</option> <option>POFILES=<replaceable>"de.po"</replaceable></option> <option>PACKAGE=kmymoney2</option></userinput>
</screen>
You can merge multiple po files at the same time. Just list them in the POFILES option.
<screen>
<prompt>thb:~/kmymoney2/po> </prompt><userinput><command>make</command> <option>-f</option> <option>../admin/Makefile.common</option> <option>package-merge</option> <option>POFILES=<replaceable>"de.po es.po"</replaceable></option> <option>PACKAGE=kmymoney2</option></userinput>
</screen>
</para>
</sect1>
</chapter>
|