summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/tools/linguist/book/linguist-translator.leaf
blob: 7a71b6aebc2f0890aab6d913b21e623a781cbc54 (plain)
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
\chapter Translators

\img linguist.png
\caption Linguist Main Window

\section1 The One Minute Guide to Using Qt Linguist

\index Linguist
\index Qt Linguist
\index Contexts!for Translation

\e {Qt Linguist} is a tool for adding translations to Qt
applications. It introduces the concept of a translation "context"
which means a group of phrases that appear together on the screen
e.g. in the same menu or dialog.

To start, run \e {Qt Linguist}, either from the taskbar menu, or by
double clicking the desktop icon, or type \c {linguist} (followed by
\Key Enter) at the command line. Once \e {Qt Linguist} has started
choose \Menu File|Open from the menu bar and select a \c .ts
translation source file to work on.

\e {Qt Linguist}'s main window is divided into four main areas. The
left hand side contains the Context list, the top right is the Source
text area, the middle right is the translation area and the bottom
right is the phrases and guesses area. We'll describe them in detail
later.

Click on one of the contexts in the context list (left hand side) and
then click on one of the phrases that appears in the Source text area
(top right). The phrase will be copied into the translation area
(middle right). Click under the word 'Translation' and type in the
translation. Click \Key Ctrl+Enter (Done \& Next) to confirm that you
have completed the translation and to move on to the next phrase that
requires translation.

The cycle of entering a translation then pressing \Key Ctrl+Enter can
be repeated until all the translations are done or until you finish
the session. Linguist will attempt to fill the "phrases and guesses"
area with possible translations from any open phrase books and any
previous translations. Each has a keyboard shortcut, e.g.
\Key Ctrl+1, \Key Ctrl+2, etc., which you can use to copy the
guess into the Translation area. (Mouse users can double click a
phrase or guess to move it into the Translation area.) At the end of
the session choose \Menu File|Save from the menu bar and then
\Menu File|Exit to quit.

\section1 Qt Linguist's Main Window

\section2 Context List

\index Contexts!for Translation

This appears at the left hand side of the main window by default. The
first column, 'Done', identifies whether or not the translations for the
context have been done. A tick indicates that all the translations have
been done and are valid. A question mark indicates that one or more
translations have not been done or have failed validation. The second
column, 'Context' is the name of the context in which the translation
phrases appear. The third column, 'Items' shows two numbers, the first
is the number of translations that have been done, and the second is the
number of phrases that are in the context; if the numbers are equal then
all the translations have been done. Note that a greyed out tick
indicates an obsolete translation, i.e. a phrase that was translated in
a previous version of the application but which does not occur in the
new version.

The contexts are ordered alphabetically. The phrases within each context
are in the order in which they appear in the source program and this may
not be the order in which they are shown on screen.

The Context List is a dockable window so it can be dragged to another
position in the main window, or dragged out of the main window to be a
window in its own right. If you move the Context List, \e {Qt
Linguist} will remember its position and restore it whenever you
start the program.

\section2 Source Text Area

This appears at the top right of the main window by default. The first
column, 'Done', signifies the status of the translation. A tick
indicates that the phrase has been translated and passed validation. A
question mark indicates that the translation has not been done. An
exclamation mark indicates that the translation has failed validation.
The second column 'Source text' shows the text that must be translated.
The third column shows the translation.

\e{Qt Linguist} provides three kinds of validation: accelerator,
punctuation and phrase. If the source text contains an accelerator
i.e. an ampersand, '\&' and the translated text does not contain an
ampersand the translation will fail the accelerator validation.
Similarly, if the source text ends with a particular punctuation
mark, e.g. '?', '!' or '.' and the translation ends with a different
punctuation mark the translation will fail the punctuation
validation. If the source text has a translation in one of the open
phrase books that differs from the translation used the translation
will fail phrase validation. (See \l Validation.)

The Source Text Area is a dockable window.

\section2 Translation Area

This area appears at the middle right of the main window by default. It
is comprised of three vertical sections. The first section is labelled
'Source text' below which the source text appears. The second section
contains contextual information on a light blue background that the
programmer has added to assist the translator. If no contextual
information has been given this section does not appear. The third
section is labelled 'Translation' and this is where you enter the
translation of the source text.

\section2 Phrases and Guesses Area

\index Phrases!in Qt Linguist
\index Guesses!in Qt Linguist

This area appears at the bottom right of the main window by default.
When you move to a new phrase if the phrase is in one of the phrase
books that has been loaded the phrase will appear in this area with its
translation. If the phrase is the same or similar to another phrase that
has already been translated the phrase and translation will be shown in
this area. To copy a translation from the phrases and guesses area press
\Key F6 to move to the phrases and guesses area, use the up and down arrow
keys to move to the phrase you want to use and press Enter to copy it.
If you decide that you don't want to copy a phrase after all, press Esc.
In both cases the focus will return to the Translation area.
Alternatively, double click the translation you want to use and it will
be copied into the translation area.

The Phrases and Guesses Area is a dockable window.

\section1 Common Tasks

\section2 Leaving a Translation for Later

If you wish to leave a translation press \Key Ctrl+L (Next Unfinished) to
move to the next unfinished translation. An unfinished translation is
one that either has not been translated at all or one which fails
validation. To move to the next phrase press \Key Shift+Ctrl+L. You can also
navigate using the Translation menu. If you want to go to a different
context entirely, click the context you want to work on in the Context
list, then click the source text in the Source Text area.

\section2 Phrases That Require Multiple Translations Depending on Context

\index Contexts!for Translation
\index Comments!for Translators

The same phrase may occur in two or more contexts without conflict. Once
a phrase has been translated in one context, \e {Qt Linguist} notes
that the translation has been made and when the translator reaches a
later occurrence of the same phrase \e {Qt Linguist} will provide
the previous translation as a possible translation candidate in the
phrases and guesses area. If the
previous translation is acceptable just click the \e {Done \& Next}
button (press \Key Ctrl+Enter) to move on to the next unfinished phrase.

If a phrase occurs more than once in a particular context it will only
be shown once in \e {Qt Linguist}'s context list and
the translation will be applied to every occurrence within the context.
If the same phrase needs to be translated differently within the same
context the programmer must provide a distinguishing comment for each of
the phrases concerned. If such comments are used the duplicate phrases
will appear in the context list. The programmers comments will appear in
the translation area on a light blue background.

\section2 Changing Keyboard Accelerators

\index Accelerators
\index Keyboard Accelerators

A keyboard accelerator is a key combination that when pressed will
cause an application to perform an action. Keyboard accelerators
normally come in two forms: Alt key and Ctrl key accelerators.

\index Alt Key

Alt key accelerators are used for menus and buttons.  The underlining
signifies that pressing the Alt key with the underlined letter is the
same as clicking the menu item with the mouse.  For example, most
applications have a \e File menu with the "F" in the word "file"
underlined. In these applications the file menu can be invoked either by
clicking the word "File" on the menu bar or by pressing Alt+F. The
accelerator key which is underlined is signified by preceeding it with
an ampersand, e.g. \e \&File. If a source phrase appears with an
ampersand in it then the translation should also contain an ampersand,
preferably in front of the same letter. The meaning of Alt key
accelerators can be determined from the phrase in which the ampersand is
embedded. The translator may need to change the letter used with the Alt
key, e.g. if the translated phrase does not contain the original
accelerator letter. Conflicts with other keys, i.e. having two Alt key
accelerators using the same letter in the same context, must be avoided.
Note that some Alt key accelerators, usually those on the menu bar, may
apply in other contexts.

\index Ctrl Key

Ctrl key accelerators can exist independently of any visual control.
They are often used to invoke actions in menus that would otherwise
take several keystrokes or mouse clicks. They may also be used to
perform actions that do not appear in any menu or on any button. For
example, most applications that have a \e File menu have a submenu
item called \e New. In many applications this will appear as "\NEW
Ctrl+N". This menu option could be invoked by clicking \e File then
clicking \e New with the mouse. Or you could press Alt+F then press N
since these letters are underlined. But the same thing can be achieved
simply by pressing \Key Ctrl+N. Accelerators that use the Ctrl key are
shown literally in the source text, e.g. \Key Ctrl+Enter. Ctrl key
accelerators have no phrase so the translator \index Comments!for
Translators must rely on the programmer to add a "comment" which
appears in the top right hand pane. This comment should explain what
action the Ctrl key accelerator performs. Ideally Ctrl key
accelerators are translated simply by copying them by chossing the \e
{Begin from Source} entry in the \Menu Translations menu. However in
some cases the letter will not make sense in the target language and
must be changed. Whatever letter (or digit) is chosen, the translation
should always be in the form "Ctrl+" followed by the letter or digit
in upper case. As with Alt key accelerators, if the translator changes
the key it must not conflict with any other Ctrl key accelerator.

Later versions of \e {Qt Linguist} are expected to help the
translator avoid accelerator conflicts.

\section2 Dealing with Phrases that Contain Variables

Some phrases contain variables. Variables are placeholders for items of
text that are filled in at runtime. They are signified in the source
text with a percent sign followed by a digit, e.g. \e {After processing
file %1, file %2 is next in line}. In this example, \c %1 will be
replaced at runtime with the name of the first file to be processed and
\c %2 with the name of the next file to be processed. In the translated
version the variables must still appear. For example a German
translation might reverse the phrases, e.g. \e {Datei %2 wird
bearbeitet, wenn. Datei %1 fertig ist}. Note that both variables
are still used but their order has changed. The order in which variables
appear does not matter; \c %1 will always be replaced by the same text
at runtime no matter where it appears in the source text or translation
and similarly \c %2, etc.

\section2 Reusing Translations

If the translated text is similar to the source text, choose the \e
{Begin from Source} entry in the \Menu Translations menu (press \Key
Ctrl+B) which will copy the source text into the translation area.

\e {Qt Linguist} automatically lists phrases from the open phrase
books and similar or identical phrases that have already been translated
in the Phrases and guesses area.

\section1 Creating and Using Phrase Books

\index Phrases!in Qt Linguist
\index Phrase Books

\img phrasebookdialog.png
\caption Phrase Book Dialog

A \e {Qt Linguist} phrase book is a set of source phrases, target
(translated) phrases, and optional definitions. Phrase Books are created
independently of any application, although typically one phrase book
will be created per application or family of applications.

If the translator reaches an untranslated phrase that is the same as a
source phrase in the phrase book, \e {Qt Linguist} will show the
phrase book entry in the \e {Relevant phrases} panel at the bottom
right of the main window. Phrases which have translations that conflict
with those given in the phrase book are marked with a question mark in
the source text pane. Phrase Books are used to provide a common set of
translations to help ensure consistency. They can also be used to avoid
duplication of effort since the translations for a family of
applications can be produced once in the phrase book and the phrase book
used for the majority of translations in each application.

Before a phrase book can be edited it must be created or if it already
exists, opened. Create a new phrase book by selecting
\Menu {Phrase|New Phrase Book} from the menu bar. You must enter a
filename and may change the location of the file if you wish. A newly
created phrase book is automatically opened. Open an existing phrase
book by choosing \Menu {Phrase|Open Phrase Book} from the menu bar.

To add a new phrase click the \Button {New Phrase} button (or press
Alt+N) and type in a new source phrase. Press Tab and type in the
translation. Optionally press Tab and enter a definition -- this is
useful to distinguish different translations of the same source phrase.
This process may be repeated as often as necessary.

You can delete a phrase by selecting it in the phrases list and clicking
Remove Phrase.

Click the \e Save button (press Alt+S) and then click the \e Close
button (press Esc) once you've finished adding (and removing) phrases.

When a phrase or set of phrases appears in the phrase book double
clicking the required target phrase will copy it to the translation
pane at the text cursor position. If you want to \e replace the text
in the translation pane with the target phrase, click the translation
pane, choose \Menu {Edit|Select All} (press \Key Alt+A) and then
double click the target phrase.

\section1 Validation

\index Validation of Translations
\index Accelerators!Validation
\index Punctuation!Validation
\index Phrases!Validation

\e {Qt Linguist} provides three kinds of validation on translated
phrases.

\list 1
\i \e {Accelerator validation} detects translated phrases
that do not have an ampersand when the source phrase does and vice
versa.
\i \e {Punctuation validation} detects differences in the
terminating punctuation between source and translated phrases when this
may be significant, e.g. warns if the source phrase ends with an
ellipsis, exclamation mark or question mark, and the translated phrase
doesn't and vice versa.
\i \e {Phrases validation} detects source phrases that are
also in the phrase book but whose translation differs from that given in
the phrase book.
\endlist

Validation may be switched on or off from the menu bar's Validation item
or using the toolbar buttons. Phrases that fail validation are marked
with a question mark in the source text pane. If you switch validation
off and then switch it on later, \e{Qt Linguist} will recheck all
phrases and mark any that fail validation.

If any phrase in a context is invalid then the context itself will be
marked with a question mark; if all the phrases in a context are done
and are valid the context will be marked with a tick.

Note that only phrases which are marked as done (with a tick) will
appear in the application. Invalid phrases and phrases which are
translated but not marked as done are kept in the translation source
file but are not used by the application.

\section1 Qt Linguist Reference

\section2 File Types

\e {Qt Linguist} makes use of three kinds of file:

\index .ts Files
\index Translation Source Files
\index .qm Files
\index Qt Message Files
\index .qph Files
\index Qt Phrase Book Files

\list
\i \c .ts \e {translation source files} \BR are human-readable XML
files containing source phrases and their translations. These files are
usually created and updated by \l lupdate and are specific to an
application.
\i \c .qm \e {Qt message files} \BR are binary files that contain
translations used by an application at runtime. These files are
generated by \l lrelease, but can also be generated by \e {Qt
Linguist}.
\i \c .qph \e {Qt phrase book files} \BR are human-readable XML
files containing standard phrases and their translations. These files
are created and updated by \e {Qt Linguist} and may be used by any
number of projects and applications.
\endlist

\section2 The Menu Bar

\img menubar.png
\caption Menu Bar

\list
\i \e {File}
    \list
    \i \e {Open... Ctrl+O} \BR pops up an open file dialog from which a
    translation source \c .ts file can be chosen.
    \i \e {Save Ctrl+S} \BR saves the current translation source \c .ts file.
    \i \e {Save As...} \BR pops up a save as file dialog so that the
    current translation source \c .ts file may be saved with a different
    name and/or put in a different location.
    \i \e {Release...} \BR pops up a save as file dialog. The
    filename entered will be a Qt message \c .qm file of the translation
    based on the current translation source file. The release manager's
    command line tool \l lrelease performs the same function on
    \e all of an application's translation source files.
    \i \e {Print... Ctrl+P} \BR pops up a print dialog. If you click
    OK the translation source and the translations will be printed.
    \i \e {Recently opened files} \BR shows the \c .ts files that
    have been opened recently, click one to open it.
    \i \e {Exit Ctrl+Q} \BR closes \e {Qt Linguist}.
    \endlist

\i \e {Edit}
    \list
    \i \e {Undo Ctrl+Z} \BR undoes the last editing action in the
    translation pane.
    \i \e {Redo Ctrl+Y} \BR redoes the last editing action in the
    translation pane.
    \i \e {Cut Ctrl+X} \BR deletes any highlighted text in the
    translation pane and saves a copy to the clipboard.
    \i \e {Copy Ctrl+C} \BR copies the highlighted text in the
    translation pane to the clipboard.
    \i \e {Paste Ctrl+V} \BR pastes the clipboard text into the
    translation pane.
\omit
    \i \e {Delete} \BR deletes the highlighted text in the
    translation pane.
\endomit
    \i \e {Select All Ctrl+A} \BR selects all the text in the
    translation pane ready for copying or deleting.
    \i \e {Find... Ctrl+F} \BR pops up the
    \link {The Find Dialog} Find dialog \endlink. When the dialog pops up
    enter the text to be found and click the \e {Find Next} button.
    Source phrases, translations and comments may be searched.
    \i \e {Find Next F3} \BR finds the next occurrence of the text that
    was last entered in the Find dialog.
    \endlist

\i \e {Translation}
    \list
    \i \e {Prev Unfinished Ctrl+K} \BR moves to the nearest previous
    unfinished source phrase (unfinished means untranslated or
    translated but failed validation).
    \i \e {Next Unfinished Ctrl+L} \BR moves to the next unfinished source
    phrase.
    \i \e {Prev Shift+Ctrl+K} \BR moves to the previous source phrase.
    \i \e {Next Shift+Ctrl+L} \BR moves to the next source phrase.
    \i \e {Done \& NextCtrl+Enter} \BR mark this phrase as 'done'
    (translated) and move to the next unfinished source phrase.
    \i \e {Begin from Source Ctrl+B} \BR copies the source text into
    the translation.
    \endlist

\i \e {Validation} (See the \l Validation section)
    \list
    \i \e {Accelerators} \BR toggles validation on or off for Alt
    accelerators.
    \i \e {Ending Punctuation} \BR switches validation on or off
    for phrase ending punctuation, e.g. ellipsis, exclamation mark,
    question mark, etc.
    \i \e {Phrase Matches} \BR sets validation on or off for
    matching against translations that are in the current phrase book.
    \endlist

\i \e {Phrase} (See the section \l {Creating ... Phrase
Books} for details.)
    \list
    \i \e {New Phrase Book... Ctrl+N} \BR pops up a save as file dialog.
    You must enter a filename to be used for the phrase book and save
    the file. Once saved you should open the phrase book to begin using
    it.
    \i \e {Open Phrase Book... Ctrl+H} \BR pops up an open file dialog.
    Find and choose a phrase book to open.
    \i \e {Close Phrase Book} \BR closes the current phrase book.
    This will stop any further phrase validation taking place.
    The same effect can be achieved by switching off phrase validation
    using the Validation menu or the phrase toolbar button.
    \i \e {Edit Phrase Book...} \BR pops up the
    \link {The Phrase Dialog} phrase book dialog \endlink where you can
    add, edit or delete phrases.
    \i \e {Print Phrase Book...} \BR pops up a print dialog. If
    you click OK the phrase book will be printed.
    \endlist

\i \e {View}
    \list
    \i \e {Revert Sorting} \BR puts the phrases in the source text
    pane into their original order.
    \i \e {Display Guesses} \BR turns the display of phrases and
    guesses on or off.
    \i \e {Statistics} \BR toggles the visibility of the Statistics dialog.
    \i \e {Views} \BR toggles the visibility of the Context, Source text and
     Phrase views.
    \i \e {Toolbars} \BR toggles the visibility of the different toolbars.
\omit
    \i \e {Large Icons} \BR switches between large or standard
    size icons on the toolbar.
    \i \e {Text Labels} \BR toggles the use of text labels on the
    toolbar icons.
\endomit
    \endlist

\endlist

\section2 The Toolbar

\img toolbar.png
\caption Toolbar

\list
\i \img fileopen.png
\BR
Pops up the open file dialog to open a new translation source \c .ts
file.

\i \img filesave.png
\BR
Saves the current translation source \c .ts file.

\i \img fileprint.png
\BR
Prints the current translation source \c .ts file.

\i \img phrasebookopen.png
\BR
Pops up the file open dialog to open a new phrase book \c .qph file.

\i \img editundo.png
\BR
Undoes the last editing action in the translation pane.

\i \img editredo.png
\BR
Redoes the last editing action in the translation pane.

\i \img editcut.png
\BR
Deletes any highlighted text in the translation pane and save a copy to
the clipboard.

\i \img editcopy.png
\BR
Copies the highlighted text in the translation pane to the clipboard.

\i \img editpaste.png
\BR
Pastes the clipboard text into the translation pane.

\i \img editfind.png
\BR
Pops up the \link {The Find Dialog} Find dialog \endlink.

\i \img prev.png
\BR
Moves to the previous source phrase.

\i \img next.png
\BR
Moves to the next source phrase.

\i \img prevunfinished.png
\BR
Moves to the previous unfinished source phrase.

\i \img nextunfinished.png
\BR
Moves to the next unfinished source phrase.

\i \img doneandnext.png
\BR
Marks the phrase as 'done' (translated) and move to the next
unfinished source phrase.

\i \img validateaccelerators.png
\BR
Toggles accelerator validation on and off.

\i \img validatepunctuation.png
\BR
Toggles phrase ending punctuation validation on and off.

\i \img validatephrases.png
\BR
Toggles phrase book validation on or off.
\endlist

\section2 The Find Dialog

\img finddialog.png
\caption The Find Dialog

Choose \Menu Edit|Find from the menu bar or press \Key Ctrl+F to pop
up the Find dialog. Press \Key F3 to repeat the last search. By
default the source phrases, translations and comments will all be
searched and the search will be case-insensitive. These settings can
be changed by checking or unchecking the checkboxes to reflect your
preferences.

\section2 The Phrase Dialog

This dialog is explained in the \l {Creating and Using Phrase Books}
section.