Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
linguist-manual.qdoc
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \page qtlinguist-index.html
6 \title Qt Linguist Manual
7 \ingroup qttools
8 \ingroup internationalization
9 \brief Using Qt translation tools: lupdate, lrelease, and \QL.
10
11 \startpage {index.html}{Qt Reference Documentation}
12 \nextpage Release managers
13
14 \keyword Qt Linguist
15
16 Release managers, translators, and developers can use Qt tools to translate
17 Qt C++ and Qt Quick applications into local languages.
18
19 In addition to the Qt translation file (TS) format, \QL and \c lupdate
20 support XML Localization Interchange File Format (XLIFF).
21
22 \table
23 \row
24 \li \inlineimage front-publishing.png
25 \li \inlineimage front-ui.png
26 \li \inlineimage front-coding.png
27 \row
28 \li \l{Release managers}
29 \li \l{Translators}
30 \li \l{Developers}
31 \row
32 \li
33 \list
34 \li \l {Creating translation files}
35 \li \l {Using lupdate}
36 \li \l {Using lrelease}
37 \endlist
38 \li
39 \list
40 \li \l {Qt Linguist user interface}
41 \li \l {Translating strings}
42 \li \l {Selecting context to translate}
43 \li \l {Selecting strings to translate}
44 \li \l {Viewing strings in context}
45 \li \l {Reusing translations}
46 \li \l {Validating translations}
47 \li \l {Translating multiple languages simultaneously}
48 \endlist
49 \li
50 \list
51 \li \l{TS file format}
52 \li \l{Text ID based translations}
53 \li \l{CMake Commands in Qt6 LinguistTools}{CMake commands}
54 \li \l{Examples}
55 \endlist
56 \endtable
57
58 The following video shows how to internationalize and localize a simple
59 example application:
60
61 \youtube xNIz78IPBu0
62*/
63
64/*!
65 \page linguist-toc.html
66 \title All topics
67
68 \list
69 \li \l{Release managers}
70 \list
71 \li \l {Creating translation files}
72 \li \l {Using lupdate}
73 \li \l {Using lrelease}
74 \endlist
75 \li \l{Translators}
76 \list
77 \li \l {Qt Linguist user interface}
78 \li \l {Translating strings}
79 \li \l {Selecting context to translate}
80 \li \l {Selecting strings to translate}
81 \li \l {Viewing strings in context}
82 \li \l {Reusing translations}
83 \li \l {Validating translations}
84 \li \l {Translating multiple languages simultaneously}
85 \endlist
86 \li \l{Developers}
87 \list
88 \li \l{TS file format}
89 \li \l{Text ID based translations}
90 \li \l{CMake Commands in Qt6 LinguistTools}{CMake commands}
91 \li \l{Examples}
92 \endlist
93 \endlist
94 */
95
96/*!
97 \page linguist-manager.html
98 \title Release managers
99
100 \previouspage Qt Linguist Manual
101 \nextpage Creating translation files
102
103 \image front-publishing.png
104
105 Release managers use \c lupdate to generate a set of translation source (TS)
106 files from the application source files (QML and C++) and pass them to
107 translators. The translators use \QL to translate the strings and pass the
108 TS files back to the release managers. They use \c lrelease to generate
109 compact versions of the TS files, called Qt message (QM) files, that are
110 ready for use by the application.
111
112 \list
113 \li \l {Creating translation files}
114 \li \l {Using lupdate}
115 \li \l {Using lrelease}
116 \endlist
117
118 You can use the tools in repeated cycles as applications change and evolve.
119 They preserve existing translations and make it easy to identify new strings.
120 In addition, you can use the \QL phrase books to consistently translate
121 multiple applications and projects.
122
123 You can configure CMake projects to automatically run \c lupdate and
124 \c lrelease when you build a project and generate TS and QM files for you.
125
126 You can use the Qt Design Studio
127 \l{https://doc-snapshots.qt.io/qtdesignstudio/studio-translations.html}
128 {Translations} view to test and manage \l {Text ID based translations}
129 {ID-based translations}.
130*/
131
132/*!
133 \page linguist-creating-ts-files.html
134
135 \previouspage Release managers
136 \nextpage Using lupdate
137
138 \title Creating translation files
139
140 Most of the text to translate in an application consists of either single
141 words or short phrases. These typically appear as window titles, menu
142 items, tooltips, and labels to buttons, check boxes, and radio buttons.
143
144 Developers mark the phrases as translatable in the QML and C++ source code.
145 The Qt tools provide context information for each of the phrases to help the
146 translator understand their meaning. The developer can add comments to the
147 phrases.
148
149 Translation files consist of all the user-visible text and \key Ctrl key
150 shortcuts in an application and translations of that text.
151
152 To create translation files:
153
154 \list 1
155
156 \li Run \c lupdate to generate the first set of translation source (TS)
157 files with all the user-visible text but no translations.
158
159 \li Give the TS files to translators who add translations using \QL.
160 \QL indicates changed and deleted source text.
161
162 \li Run \c lupdate to incorporate any new text added to the application.
163 \c lupdate synchronizes the user-visible text from the application
164 with the translations. Existing translations in the TS file are
165 preserved.
166
167 \li Run \c lrelease to read the TS files and produce the QM files used
168 by the application at runtime.
169
170 \endlist
171
172 For \c lupdate to work successfully, it must know which translation files to
173 produce. Specify the files in the application's Qt project file.
174
175 When building with CMake, you use \l{CMake Commands in Qt6 LinguistTools}
176 {CMake commands} to add targets that create or update TS files and transform
177 them into QM files. The translation files are generated when you build the
178 targets.
179*/
180
181/*!
182 \page linguist-lupdate.html
183 \target lupdate
184
185 \previouspage Release managers
186 \nextpage Using lrelease
187
188 \title Using lupdate
189
190 The \c lupdate command line tool finds translatable strings in C++ source,
191 C++ header, Java, Python, QML, and UI files and generates or updates TS
192 files.
193
194 When building with qmake, specify the files to process at the command line
195 or in a .pro file.
196
197 When building with CMake, use \l{CMake Commands in Qt6 LinguistTools}
198 {CMake commands} to add targets that create or update TS files and transform
199 them into QM files. The \c lupdate tool is run with the \l {lupdate options}
200 {options} you pass to the commands when you build the target.
201
202 For more information about specifying translations in project files, see
203 \l{Localizing Applications}.
204
205 \section1 lupdate syntax
206
207 \badcode
208 lupdate [options] [project-file]...
209 lupdate [options] [source-file|path|@lst-file]... -ts ts-files|@lst-file
210 \endcode
211
212 Where:
213
214 \list
215 \li \c options means one or several \l {lupdate options}.
216 \li \c project-file is the project configuration file.
217 \li \c source-file is a file that contains translatable strings.
218 \li \c path is the path to a folder that contains translation
219 source files.
220 \li \c @lst-file reads additional file names (one per line) or
221 includepaths (one per line and prefixed with \c -I) from \e lst-file.
222 \li \c ts-files are the TS files to generate or update.
223 \endlist
224
225 To view the latest help, enter:
226
227 \badcode
228 lupdate -help
229 \endcode
230
231 \section2 lupdate options
232
233 \table
234 \header
235 \li Option
236 \li Action
237 \row
238 \li \c {-help}
239 \li Display up-to-date help information and exit.
240 \row
241 \li \c {-no-obsolete}
242 \li Drop all obsolete and vanished strings.
243 \row
244 \li \c {-extensions <ext>[,<ext>]...}
245 \li Process files with the given extensions, only. Use commas to
246 separate extensions in the list. Do not use whitespace. The default
247 value is:
248 \c {java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml,qrc}.
249 \row
250 \li \c {-pluralonly}
251 \li Only include plural form messages.
252 \row
253 \li \c {-silent}
254 \li Do not explain what is being done.
255 \row
256 \li \c {-no-sort}
257 \li Do not sort contexts in TS files.
258 \row
259 \li \c {-no-recursive}
260 \li Do not recursively scan directories.
261 \row
262 \li \c {-recursive}
263 \li Recursively scan directories (default).
264 \row
265 \li \c {-I <includepath> or -I<includepath>}
266 \li Look for include files in this additional location. You can specify
267 multiple paths.
268 \row
269 \li \c {-locations {absolute|relative|none}}
270 \li Specify or override the way to save source code references in TS
271 files.
272 \list
273 \li \c absolute means that the source file path is relative to
274 the target file, but the line number is absolute.
275 \li \c relative means that the source file path is relative to
276 the target file. The line number is relative to other
277 entries in the same source file.
278 \li \c none stores no information about source location.
279 \endlist
280 If you do not specify the location, \c lupdate determines it from
281 existing TS files. The default value for new files is \c absolute.
282 \row
283 \li \c {-no-ui-lines}
284 \li Do not record line numbers in references to UI files.
285 \row
286 \li \c {-disable-heuristic {sametext|similartext}}
287 \li Disable the named merge heuristic. Can be specified multiple times.
288 \row
289 \li \c {-project <filename>}
290 \li Name of a file containing the project's description in JSON format.
291 You can use the \c lprodump tool to generate the file from a .pro
292 file.
293 \row
294 \li \c {-pro <filename>}
295 \li Name of a .pro file. Useful for files with the .pro file syntax but
296 some other file suffix. Projects are recursed into and merged.
297 This option is deprecated. Use the \c lupdate-pro tool instead.
298 \row
299 \li \c {-pro-out <directory>}
300 \li Virtual output directory for processing subsequent .pro files.
301 \row
302 \li \c {-pro-debug}
303 \li Trace processing .pro files. Specify twice for more verbosity.
304 \row
305 \li \c {-source-language <language>[_<region>]}
306 \li Specify the language of the source strings for new files.
307 Defaults to POSIX if not specified.
308 \row
309 \li \c {-target-language <language>[_<region>]}
310 \li Specify the language of the translations for new files.
311 If you do not specify the language, \c lupdate determines it from
312 the file name.
313 \row
314 \li \c {-tr-function-alias <function>{+=,=}<alias>[,<function>{+=,=}<alias>]...}
315 \li With \c {+=}, recognize \c <alias> as an alternative spelling of
316 \c <function>.
317 With \c {=,} recognize \c <alias> as the only spelling of
318 \c <function>.
319
320 Available \c <function> values (with their currently defined aliases)
321 are:
322 \list
323 \li \c {Q_DECLARE_TR_FUNCTIONS} (\c {=Q_DECLARE_TR_FUNCTIONS})
324 \li \c {QT_TR_N_NOOP} (\c {=QT_TR_N_NOOP})
325 \li \c {QT_TRID_N_NOOP} (\c {=QT_TRID_N_NOOP})
326 \li \c {QT_TRANSLATE_N_NOOP} (\c {=QT_TRANSLATE_N_NOOP})
327 \li \c {QT_TRANSLATE_N_NOOP3} (\c {=QT_TRANSLATE_N_NOOP3})
328 \li \c {QT_TR_NOOP} (\c {=QT_TR_NOOP})
329 \li \c {QT_TRID_NOOP} (\c {=QT_TRID_NOOP})
330 \li \c {QT_TRANSLATE_NOOP} (\c {=QT_TRANSLATE_NOOP})
331 \li \c {QT_TRANSLATE_NOOP3} (\c {=QT_TRANSLATE_NOOP3})
332 \li \c {QT_TR_NOOP_UTF8} (\c {=QT_TR_NOOP_UTF8})
333 \li \c {QT_TRANSLATE_NOOP_UTF8} (\c {=QT_TRANSLATE_NOOP_UTF8})
334 \li \c {QT_TRANSLATE_NOOP3_UTF8} (\c {=QT_TRANSLATE_NOOP3_UTF8})
335 \li \c {findMessage} (\c {=findMessage})
336 \li \c {qtTrId} (\c {=qtTrId})
337 \li \c {tr} (\c {=tr})
338 \li \c {trUtf8} (\c {=trUtf8})
339 \li \c {translate} (\c {=translate})
340 \li \c {qsTr} (\c {=qsTr})
341 \li \c {qsTrId} (\c {=qsTrId})
342 \li \c {qsTranslate} (\c {=qsTranslate})
343 \endlist
344 \row
345 \li \c {-ts <ts-file>...}
346 \li Specify the output files. This overrides \c TRANSLATIONS.
347 \row
348 \li \c {-version}
349 \li Display the version of \c lupdate and exit.
350 \row
351 \li \c {-clang-parser [compilation-database-dir]}
352 \li Use clang to parse .cpp files. Otherwise, use a custom
353 parser. This option needs a clang compilation database
354 (\c compile_commands.json) for the files to be parsed.
355 Specify the path to the directory containing this file
356 on the command line, directly after the \c -clang-parser
357 option, or in the project file.
358
359 When using qmake, set the \c LUPDATE_COMPILE_COMMANDS_PATH
360 variable in the .pro file.
361
362 A directory specified on the command line takes precedence. If you
363 do not specify a path, \c lupdate searches for the compilation
364 database from all parent paths of the first input file.
365 \row
366 \li \c {-project-roots <directory>...}
367 \li Specify one or more project root directories. Only files
368 below a project root are considered for translation when
369 using the \c -clang-parser option.
370 \endtable
371
372 \section1 Examples
373
374 \section2 Using lupdate with CMake
375
376 When building with CMake, use \l{CMake Commands in Qt6 LinguistTools}
377 {CMake commands} to add translations on targets to the CMakeLists.txt
378 file, and then build the targets.
379
380 Select one of the following options:
381
382 \list
383 \li Use \l qt_add_translations on a target, such as \e app.
384 This calls \l qt_add_lupdate and \l qt_add_lrelease.
385 \li Use \c qt_add_lupdate on a target.
386 \endlist
387
388 Build a target (for example, \c app_lupdate) to update the .ts
389 files for it. To update the .ts files for all targets, build the
390 target \c {update_translations}.
391
392 \section2 Using lupdate with qmake
393
394 To generate a translation file for a single QML file:
395
396 \badcode
397 lupdate main.qml -ts main_en.ts
398 \endcode
399
400 To make a translation file for another language, for example French,
401 copy main_en.ts to main_fr.ts, and translate the strings in the
402 French TS file.
403
404 \c lupdate processes QML files that are listed in the \c .qrc file:
405
406 \badcode
407 RESOURCES += qml.qrc
408 \endcode
409
410 To have all QML files processed by \c lupdate:
411
412 \badcode
413 lupdate application.qrc -ts myapp_en.ts
414 \endcode
415
416 To process all QML files in the current working directory (or its subfolders)
417 without using a \c .qrc file:
418
419 \badcode
420 lupdate . -extensions qml -ts myapp_en.ts
421 \endcode
422
423 To check for translatable strings in both QML and C++ source files:
424
425 \badcode
426 lupdate qml.qrc filevalidator.cpp -ts myapp_en.ts
427 \endcode
428
429 To generate .ts files that will be used for English and French without
430 specifying the languages in the project file:
431
432 \badcode
433 lupdate qml.qrc filevalidator.cpp -ts myapp_en.ts myapp_fr.ts
434 \endcode
435
436 Give the TS files to the translator who uses \QL to read the files and
437 insert the translations.
438
439 \section1 XLIFF format files
440
441 The TS file format is a simple human-readable XML format that you
442 can use with version control systems. In addition, \c lupdate can
443 process Localization Interchange File Format (XLIFF) files (\c .xlf).
444
445 \note Only XLIFF versions 1.1 and 1.2 are currently supported.
446
447 You can open and edit XLIFF files in \QL.
448*/
449
450/*!
451 \page linguist-lrelease.html
452 \target lrelease
453
454 \previouspage Using lupdate
455 \nextpage Translators
456
457 \title Using lrelease
458
459 The \c lrelease command line tool produces QM files out of TS files. The
460 QM file format is a compact binary format that the localized application
461 uses. It provides extremely fast lookup for translations.
462
463 When building with qmake, specify the files to process at the command line
464 or in a .pro file.
465
466 When building with CMake, use \l{CMake Commands in Qt6 LinguistTools}
467 {CMake commands} to add targets that create or update TS files and
468 transform them into QM files. The \c lrelease tool is run with the
469 \l {lrelease options}{options} you pass to the commands when you build
470 the target.
471
472 Run \c lrelease whenever you want to release the application, from the
473 initial test version through to the final release version. The application
474 does not need QM files to run, but if they are available, the application
475 detects them and uses them automatically.
476
477 \note The \c lrelease tool only incorporates translations that you
478 mark as \e finished. Otherwise, it uses the original text instead.
479
480 \section1 lrelease syntax
481
482 \badcode
483 lrelease [options] -project project-file
484 lrelease [options] ts-files [-qm qm-file]
485 \endcode
486
487 Where:
488
489 \list
490 \li \c options means one or several \l {lrelease options}.
491 \li \c project-file is the project configuration file.
492 \li \c ts-files are the TS files to use as input for the QM files.
493 \li \c qm-file is the name of the QM file to generate.
494 \endlist
495
496 \note Passing .pro files to \c lrelease is deprecated. Use the
497 \c lrelease-pro tool or the \c lrelease.prf feature when using qmake.
498
499 To view the latest help, enter:
500
501 \badcode
502 lrelease -help
503 \endcode
504
505 \section2 lrelease options
506
507 \table
508 \header
509 \li Option
510 \li Action
511 \row
512 \li \c {-help}
513 \li Display up-to-date help information and exit.
514 \row
515 \li \c {-idbased}
516 \li Use IDs instead of source strings for message keying.
517 \row
518 \li \c {-compress}
519 \li Compress the QM files.
520 \row
521 \li \c {-nounfinished}
522 \li Do not include unfinished translations.
523 \row
524 \li \c {-removeidentical}
525 \li If the translated text is the same as the source text, exclude the
526 message.
527 \row
528 \li \c {-markuntranslated <prefix>}
529 \li If a message has no real translation, use the source text
530 prefixed with the given string instead.
531 \row
532 \li \c {-project <filename>}
533 \li Name of a file containing the project's description in JSON format.
534 You can use the \c lprodump tool to generate the file from a .pro
535 file.
536 \row
537 \li \c {-silent}
538 \li Do not explain what is being done.
539 \row
540 \li \c {-version}
541 \li Display the version of \c lrelease and exit.
542 \endtable
543
544 \section1 Examples
545
546 \section2 Using lrelease with CMake
547
548 When building with CMake, use \l{CMake Commands in Qt6 LinguistTools}
549 {CMake commands} to add translations on targets to the CMakeLists.txt
550 file, and then build the targets.
551
552 Select one of the following options:
553
554 \list
555 \li Use \l qt_add_translations on a target, such as \e app.
556 This calls \l qt_add_lupdate and \l qt_add_lrelease.
557 \li Use \c qt_add_lrelease on a target.
558 \endlist
559
560 Build a target (for example, \c app_lrelease) to update the .qm
561 files for it. To update the .qm files for all targets, build the
562 target \c {release_translations}.
563
564 \section2 Using lrelease with qmake
565
566 To run \c lrelease without specifying a project file:
567
568 \badcode
569 lrelease.exe main_en.ts languages\main_fr.ts
570 \endcode
571*/
572
573/*!
574 \page linguist-translators.html
575
576 \previouspage Using lrelease
577 \nextpage Qt Linguist user interface
578
579 \title Translators
580
581 \image front-ui.png
582
583 \QL is a tool for translating strings in Qt applications. Once you have
584 installed Qt, you can start \QL in the same way as any other application on
585 the development host.
586
587 \note You can obtain an installer for \QL only (without the entire Qt SDK)
588 from \l {https://download.qt.io/linguist_releases/}. The installer is
589 available for Windows, and works with Qt 6.
590
591 To address issues that arise from the subtleties and complexities of
592 human language, translators and developers may need to:
593
594 \list
595 \li Translate a single phrase into several different forms depending on
596 context. For example, \e open in English might become \e{\ouml}\e{ffnen},
597 \e {open file}, or \e aufbauen, \e {open internet connection}, in German.
598
599 \li Change the mnemonic characters in keyboard shortcuts without introducing
600 conflicts. For example, \c \&Quit in English becomes \e Avslutt in
601 Norwegian, which does not contain the letter \e Q. You cannot use a
602 letter that is already in use unless you change several shortcuts.
603
604 \li Rephrase strings that contain variables. For example, you might need to
605 place the variables in a different order when you translate the string
606 \e {The 25 files selected will take 63 seconds to process}, where the
607 two numbers are inserted programmatically at runtime.
608 \endlist
609
610 For more information about how to use \QL to translate applications, see:
611
612 \list
613 \li \l {Qt Linguist user interface}
614 \li \l {Translating strings}
615 \li \l {Selecting context to translate}
616 \li \l {Selecting strings to translate}
617 \li \l {Viewing strings in context}
618 \li \l {Reusing translations}
619 \li \l {Validating translations}
620 \li \l {Translating multiple languages simultaneously}
621 \endlist
622*/
623
624/*!
625 \page linguist-ui.html
626
627 \previouspage Translators
628 \nextpage Translating strings
629
630 \title Qt Linguist user interface
631
632 The \QL main window contains a menu bar and the following views:
633
634 \list
635
636 \li \uicontrol Context (\key F6) lists translation contexts.
637
638 \li \uicontrol Strings (\key F7) lists translatable strings in the
639 selected context.
640
641 \li \uicontrol {Sources and Forms} (\key F9) displays the selected
642 string in the source code.
643
644 \li Translation area displays the selected string and enables you to
645 enter a translation for it.
646
647 \li \uicontrol {Phrases and guesses} (\key F10) lists possible
648 translations for the current string.
649
650 \li \uicontrol Warnings (\key F8) lists translated strings that fail
651 validation tests.
652
653 \endlist
654
655 \image linguist-linguist.png {Qt Linguist UI}
656
657 The translation area (1) is always visible. To show or hide the other views,
658 select \uicontrol View > \uicontrol Views, or use keyboard shortcuts.
659 You can drag the views by their title bars and arrange them around the
660 translation area or even outside the main window.
661*/
662
663/*!
664 \page linguist-translating-strings.html
665
666 \previouspage Qt Linguist user interface
667 \nextpage Selecting context to translate
668
669 \title Translating strings
670
671 Open translation source (TS) files in \QL for translation. TS files are
672 human-readable XML files containing source phrases and their translations.
673 TS files are usually created and updated by \c lupdate. If you do not have
674 a TS file, see \l {Creating translation files} to learn how to generate one.
675
676 You can use \QL also to translate files in the international XML
677 Localization Interchange File Format (XLIFF) that are generated by other
678 programs. However, for standard Qt projects, only the TS file format is
679 used. Only XLIFF versions 1.1 and 1.2 are currently supported.
680
681 \QL displays the target language in the translation area, and adapts the
682 number of input fields for plural forms accordingly. When you open several
683 TS files to translate simultaneously, the \uicontrol Translator and
684 \uicontrol {Translator comment} fields are displayed for each language.
685 For more information about setting the location information, see
686 \l{Changing the target locale}.
687
688 If the developer provides a disambiguating comment, you can see it in the
689 \uicontrol {Developer comments} field.
690
691 To translate strings:
692
693 \list 1
694
695 \li Select \uicontrol File > \uicontrol Open to load a TS file.
696
697 \li Select a context in the \uicontrol Context view to display translatable
698 strings in the \uicontrol Strings view.
699
700 \image linguist-ui.webp {Two TS files open in Qt Linguist}
701
702 \li Select a string to display it in the \uicontrol {Source text} field
703 in the translation area. The whitespace within the source text is
704 visualized.
705
706 \li Enter the translation of the current string in the \uicontrol Translation
707 field.
708
709 Double-click an existing translation in the
710 \uicontrol {Phrases and guesses} field to use it as the translation
711 for the current string. \QL reads the phrases from phrase books and
712 bases the guesses on existing translations of similar phrases in the
713 TS file.
714
715 \li Optionally, enter a comment for other translators in the
716 \uicontrol {Translator comment} field.
717
718 \li To accept the translation, press \key {Ctrl+Enter}, select
719 \inlineimage linguist-doneandnext.png
720 , or click the icon to the left of the selected source string in the
721 string list.
722
723 \li Select \uicontrol File > \uicontrol Save to save your work.
724
725 \endlist
726
727 Repeat this process until all strings in the string list are marked with
728 \inlineimage linguist-check-on.png
729 (\uicontrol {Accepted/Correct}) or
730 \inlineimage linguist-check-warning.png
731 (\uicontrol {Accepted/Warnings}). Then select the next context and continue.
732
733 To view the number of words and characters in the source text and in the
734 translated text, select \uicontrol View > \uicontrol Statistics.
735
736 Select \uicontrol File > \uicontrol Release to create a QM
737 file with the same base name as the current translation source file.
738 The \c lrelease tool performs the same function on \e all of an
739 application's translation source files.
740
741 To print the translation source and the translations, select \uicontrol File >
742 \uicontrol Print.
743
744 To quit \QL, select \uicontrol File > \uicontrol Exit.
745
746 \section1 Moving between translatable strings
747
748 To move to the next unfinished translation, select
749 \inlineimage nextunfinished.png
750 (\uicontrol {Next Unfinished}) or press \key{Ctrl+J}.
751
752 To move to the next source text, select \inlineimage next.png
753 , press \key{Ctrl+Shift+J}, or select \uicontrol Translation >
754 \uicontrol Next.
755
756 \section1 Phrases that require multiple translations depending on context
757
758 The same phrase may occur in more than one context without conflict. When
759 you reach another occurrence of a translated phrase, \QL provides
760 the previous translation as a possible translation in the
761 \uicontrol {Phrases and guesses} view.
762
763 If a phrase occurs more than once within a particular context, it appears
764 only once in the \uicontrol Context view, and the translation is applied
765 to every occurrence within the context. If the same phrase means different
766 things within the same context, the developer must provide a comment for
767 each occurrence of the phrase. The duplicate phrases appear in the
768 \uicontrol Context view. The developer's comments appear in the translation
769 area on a light blue background.
770
771 \section1 Changing keyboard shortcuts
772
773 A keyboard shortcut is a key combination that performs an action.
774
775 \section2 Alt key shortcuts
776
777 In menu item and button text, a \e mnemonic character (marked by underlining)
778 indicates that pressing \key Alt or \key Ctrl with the underlined character
779 performs the same action as clicking the menu item or pressing the button.
780
781 For example, applications often use \e F as the mnemonic character in the
782 \uicontrol {File} menu, so you can either click the menu item or press
783 \key {Alt+F} to open the menu. The mnemonic character in the translatable
784 string is prefixed with an ampersand: \c {\&File}. The translation for the
785 string should also have an ampersand in it, preferably in front of the same
786 character.
787
788 You can determine the meaning of an \key Alt key shortcut from the phrase
789 that contains the ampersand. You can use another mnemonic character if the
790 translated phrase does not contain the current one or if it is used in
791 the translation of some other shortcut in the context. Some key shortcuts,
792 usually those on the menu bar, may apply in other contexts.
793
794 \section2 Ctrl key shortcuts
795
796 \key Ctrl key shortcuts can exist independently of any visual control.
797 Typically, they invoke actions in menus that would require multiple
798 keystrokes or mouse clicks or actions that do not appear in any menu
799 or on any button. For example, the \uicontrol {File} menu might contain a
800 \uicontrol {\underline{N}ew Ctrl+N} item that you can invoke by pressing
801 \key {Ctrl+N} even when the \uicontrol {File} menu is closed.
802
803 Each \key Ctrl key shortcut appears in the \uicontrol Strings view
804 as a separate string. For example, \key{Ctrl+Enter}. Since
805 the string does not have a context to give it meaning, such as
806 the context of the phrase in which an \key Alt key shortcut appears,
807 you must rely on the developer to include a \l{QObject::tr()}
808 {disambiguation comment} to explain the action the \key Ctrl key
809 shortcut performs. The comment appears under \uicontrol {Developer comments}
810 in the translation area below the \uicontrol {Source text} field.
811
812 Ideally, you can copy translations for \key Ctrl key shortcuts by
813 selecting \uicontrol Translation > \uicontrol {Copy from source text}.
814 However, if the character does not make sense in the target language,
815 change it. Whichever character (alpha or digit) you choose, use the form
816 \key {Ctrl+} followed by the upper case character. Qt automatically displays
817 the correct name at runtime. As with \key Alt key shortcuts, if you change
818 the character, make sure that it does not conflict with any other
819 \key Ctrl key shortcut.
820
821 \note Do not translate the \key Alt, \key Ctrl or \key Shift parts of
822 the shortcuts, as Qt recognizes them and automatically translates them
823 for supported languages.
824
825 \section1 Handling numbered arguments and plural forms
826
827 A numbered argument is a placeholder that will be replaced with text at
828 runtime. It appears in a source string as a percent sign followed by
829 a digit. For example, in the \c{After processing file %1, file %2
830 is next in line} string, \c{%1} and \c{%2} are numbered arguments that
831 are replaced with the first and second file names at runtime. The
832 same numbered arguments must appear in the translation, but not
833 necessarily in the same order. A German translation of the string
834 might reverse the phrases, for example \c{Datei %2 wird bearbeitet, wenn
835 Datei %1 fertig ist}. Both numbered arguments appear in the
836 translation, but in the reverse order. A numbered argument is always
837 replaced by the same text in the translations, regardless of the position
838 in the argument sequence in the source string.
839
840 The use of numbered arguments is often accompanied by the use of
841 plural forms in the source text. In many languages, the form of the
842 text will depend on the value shown, and more than one translation
843 is required. If the developers have marked up the source text in
844 correct way, fields for each of the possible plural forms will be
845 available in the translation area. For more information, see
846 \l{Writing Source Code for Translation}.
847
848 \section1 Changing the target locale
849
850 You can set the locale information explicitly in \uicontrol Edit >
851 \uicontrol {Translation File Settings}. If the target language and country
852 are not explicitly set when you open a translation source file, \QL
853 attempts to deduct them from the translation source file name. This
854 requires that the translation files adhere to the following file name
855 convention:
856 \c appname_language[_country].ts, where:
857
858 \list
859 \li \c language is an ISO 639 language code in lowercase.
860 \li \c country is an ISO 3166 two-letter country code in uppercase.
861 \endlist
862
863 If this attempt to resolve the target language and country fails, the
864 \uicontrol {Translation File Settings} window opens.
865
866 For example, \c app_de.ts sets the
867 target language to German, and \c app_de_CH.ts sets the target language to
868 German and the target country to Switzerland. This also helps loading
869 translations for the current locale automatically. For more information, see
870 \l{Enable Translation}.
871
872 \image linguist-translationfilesettings.png
873*/
874
875/*!
876 \page linguist-selecting-context.html
877
878 \previouspage Translating strings
879 \nextpage Selecting strings to translate
880
881 \title Selecting context to translate
882
883 The \uicontrol Context view lists the contexts in which strings to be translated
884 appear. The column labeled \uicontrol Context lists the context names in
885 alphabetical order. Each context is the name of a QML type or a subclass of
886 QObject.
887
888 \image linguist-context-view.webp {Context view}
889
890 A context for QObject itself contains strings passed to the static function
891 QObject::tr().
892
893 An \e{<unnamed context>} contains strings that are not in a subclass of
894 QObject.
895
896 The following icons indicate the current translation state for each context:
897
898 \table
899 \header
900 \li State
901 \li Icon
902 \li Description
903
904 \row
905 \li Accepted/Correct
906 \li \inlineimage linguist-check-on.png
907 \li All strings in the context have been translated, and all the
908 translations passed the \l{Validating Translations}{validation tests}.
909
910 \row
911 \li Accepted/Warnings
912 \li \inlineimage linguist-check-warning.png
913 \li All strings in the context have been translated or marked as translated,
914 but at least one translation failed the validation tests.
915 In the \uicontrol Strings view, you can see which string failed the test.
916
917 \row
918 \li Not Accepted
919 \li \inlineimage linguist-check-off.png
920 \li At least one string in the context has not been translated or is not
921 marked as translated.
922
923 \row
924 \li Obsolete
925 \li \inlineimage linguist-check-obsolete.png
926 \li None of the translated strings appears in the context any more. This
927 usually means the context no longer exists in the application.
928 \endtable
929
930 The \uicontrol Items column displays the total number of translatable strings in
931 the context and the number of translated strings, separated by a slash (/).
932 If the numbers are equal, all the translatable strings in the context have
933 translations.
934*/
935
936/*!
937 \page linguist-selecting-strings.html
938
939 \previouspage Selecting context to translate
940 \nextpage Viewing strings in context
941
942 \title Selecting strings to translate
943
944 The \uicontrol Strings view lists all the translatable strings in the
945 current context and their translation acceptance state. Select a string
946 to view and edit it in the translation area.
947
948 \image linguist-strings-view.webp {Strings view}
949
950 Click the icon in front of a string to change its translation acceptance
951 state. A tick mark, green or yellow, means the string has an accepted
952 translation. A question mark means either that the translation does not
953 exist or you have not accepted it.
954
955 The following icons indicate the current translation state for each string:
956
957 \target String Translation States
958
959 \table
960 \header
961 \li State
962 \li Icon
963 \li Description
964
965 \row
966 \li Accepted/Correct
967 \li \inlineimage linguist-check-on.png
968 \li The source string has a translation (possibly empty). You accepted
969 the translation, and it passes all the \l{Validating Translations}
970 {validation tests}. Click the icon to revoke acceptance of the
971 translation. The state becomes \uicontrol {Not Accepted} if the string
972 has a translation or \uicontrol {No Translation} if the translation is
973 empty. If \c{lupdate} changes the contents of a string, its acceptance
974 state becomes \uicontrol {Not Accepted}.
975
976 \row
977 \li Accepted/Warnings
978 \li \inlineimage linguist-check-warning.png
979 \li You accepted the translation, but it does not pass all the validation
980 tests. The \uicontrol Warnings view shows where it failed. If you click
981 the icon to revoke acceptance of the translation, the state becomes
982 \uicontrol {Validation Failures}.
983
984 \row
985 \li Not Accepted
986 \li \inlineimage linguist-check-off.png
987 \li The string has a translation that passes all the validation tests, but
988 you have not yet accepted the translation. Click the icon or press
989 \key{Ctrl+Enter} to accept the translation. The state becomes
990 \uicontrol {Accepted/Correct}.
991
992 \row
993 \li No Translation
994 \li \inlineimage linguist-check-empty.png
995 \li The string does not have a translation. If you click the icon to accept
996 the empty translation, the state becomes \uicontrol {Accepted/Correct}.
997
998 \row
999 \li Validation Failures
1000 \li \inlineimage linguist-danger.png
1001 \li The string has a translation, but the translation does not pass all the
1002 validation tests. The \uicontrol Warnings view shows the validation test
1003 failures. Click on the icon or press \key{Ctrl+Enter} to
1004 accept the translation even with validation failures. The state becomes
1005 \uicontrol {Accepted/Warnings}. Usually, you should fix the causes of the
1006 validation failures. The state will automatically become
1007 \uicontrol {Not Accepted} when you fix all failures.
1008
1009 \row
1010 \li Obsolete
1011 \li \inlineimage linguist-check-obsolete.png
1012 \li The string is obsolete. It is no longer used in the context.
1013 See \l{Using lupdate} for instructions on how to remove obsolete
1014 messages from the file.
1015
1016 \endtable
1017*/
1018
1019/*!
1020 \page linguist-viewing-strings-in-context.html
1021
1022 \previouspage Selecting strings to translate
1023 \nextpage Reusing translations
1024
1025 \title Viewing strings in context
1026
1027 If \QL can access the source files containing the translatable strings, the
1028 \uicontrol {Sources and Forms} view shows the source context of the current
1029 string in the \uicontrol Strings view. It highlights the source code line
1030 that contains the current string. If \QL cannot find the source file, it
1031 shows the expected absolute file path.
1032
1033 If the source context shows the wrong source line, the translation file might
1034 be out of sync with the source files. For more information about how to sync
1035 the files, see \l{Using lupdate}.
1036
1037 \QD stores UI forms in special UI files (.ui). \QL attempts to show the
1038 translations in the forms.
1039*/
1040
1041/*!
1042 \page linguist-reusing-translations.html
1043
1044 \previouspage Viewing strings in context
1045 \nextpage Validating translations
1046
1047 \title Reusing translations
1048
1049 If the translated text is similar to the source text, select
1050 \uicontrol Translation > \uicontrol {Copy from source text}
1051 (or press \key{Ctrl+B}) to copy the source text into the
1052 translation area.
1053
1054 \e {Phrase books} provide a common set of translations
1055 to help ensure consistency. A phrase book is a set of source phrases, target
1056 (translated) phrases, and optional definitions. Typically, one phrase book
1057 is created per language and family of applications. Phrase books avoid
1058 duplication of effort since they contain translations for a family of
1059 applications.
1060
1061 The \uicontrol {Phrases and guesses} view displays the current string and its
1062 phrase book translations. If the current string is the same as or similar to
1063 a translated string, the view also lists the string and its translation.
1064
1065 To copy a translation from the \uicontrol {Phrases and guesses} view to the
1066 translation area, double-click it or select it and press \key Enter.
1067
1068 \section1 Batch translation
1069
1070 \image linguist-batchtranslation.png
1071
1072 Use the batch translation feature to automatically translate source
1073 texts that are also in a phrase book. To configure which phrase books to use
1074 in what order during the batch translation process, select \uicontrol Edit >
1075 \uicontrol {Batch Translation}. You can include only entries with no
1076 current translation and mark batch translated entries as \uicontrol Accepted.
1077
1078 \section1 Creating and editing phrase books
1079
1080 Phrase book files are human-readable XML files containing standard phrases
1081 and their translations. \QL creates and update the files. You can use them
1082 for any number of projects and applications.
1083
1084 To create a new phrase book, select \uicontrol Phrases > \uicontrol {New Phrase Book}.
1085
1086 \image linguist-phrasebookdialog.png
1087
1088 To open a phrase book, select \uicontrol Phrases > \uicontrol {Open Phrase Book}, and
1089 then select the Qt phrase book file (.qph) to open.
1090
1091 To view and change open phrase books, select \uicontrol Phrases >
1092 \uicontrol {Edit Phrase Book}.
1093
1094 To add a new phrase, select \uicontrol {New Entry} (or press \key {Alt+N}) and
1095 type in a new source phrase, the translation, and an optional definition.
1096 This is useful to distinguish different translations of the same source
1097 phrase.
1098
1099 To add the translation you are working on to the current phrase book, select
1100 \uicontrol Phrases > \uicontrol {Add to Phrase Book} or press \key{Ctrl+T}. If multiple
1101 phrase books are loaded, you have to select one.
1102
1103 If you detect an error in a phrase book entry in the
1104 \uicontrol {Phrases and guesses} view, you can edit by right
1105 clicking it and selecting \uicontrol Edit. After fixing the
1106 error press \key{Enter} to leave the editing mode.
1107
1108 To delete a phrase, select it in the \uicontrol {Source phrase} list, and then
1109 select \uicontrol {Remove Entry}.
1110
1111 To print an open phrase book, select \uicontrol Phrases >
1112 \uicontrol {Print Phrase Book}.
1113*/
1114
1115/*!
1116 \page linguist-validating-translations.html
1117
1118 \previouspage Reusing translations
1119 \nextpage Translating multiple languages simultaneously
1120
1121 \title Validating translations
1122
1123 \QL provides the following validation tests for translations:
1124
1125 \list
1126 \li \e {Accelerator validation} detects translated phrases
1127 that do not have an ampersand when the source phrase does and vice
1128 versa.
1129 \li \e {Punctuation validation} detects differences in the
1130 terminating punctuation between source and translated phrases when
1131 this may be significant. For example, warns if the source phrase
1132 ends with an ellipsis, exclamation mark or question mark, and the
1133 translated phrase does not, and vice versa.
1134 \li \e {Phrases validation} detects source phrases that are
1135 also in the phrase book but whose translation differs from that
1136 in the phrase book.
1137 \li \e {Place marker validation} detects whether the same variables
1138 (like \c %1, \c %2) appear both in the source text and in the
1139 translation.
1140 \endlist
1141
1142 To switch validation tests on or off, select \uicontrol Validation or use the
1143 toolbar buttons.
1144
1145 Not accepted strings that fail validation tests are marked with the
1146 \uicontrol {Validation Failures} icon in the \uicontrol Strings view.
1147 Accepted strings are marked with \uicontrol {Accepted/Warnings}.
1148
1149 If you switch validation off and then switch it on later,
1150 \QL rechecks all phrases and marks any that fail validation.
1151
1152 The \uicontrol Warnings view lists the strings that fail the active
1153 validation tests. The first warning is also shown in the status bar
1154 at the bottom of the main window.
1155
1156 \note Only results of \e{active} validation tests are reported.
1157*/
1158
1159/*!
1160 \page linguist-translating-multiple-languages.html
1161 \target multiple languages
1162
1163 \previouspage Validating translations
1164 \nextpage Developers
1165
1166 \title Translating multiple languages simultaneously
1167
1168 You can load and edit multiple translation files simultaneously.
1169 The following screen shot displays \e{Polish} and \e{Japanese} translation
1170 files loaded.
1171
1172 \image linguist-linguist_2.png
1173
1174 The translation area has color-coded text editing areas for both Polish and
1175 Japanese. The \uicontrol Context view and the \uicontrol Strings view have
1176 color-coded status columns for each language.
1177
1178 The \uicontrol Items column in the \uicontrol Context view combines the values
1179 for both languages. If the number of translatable strings does not match the
1180 number of accepted strings, either or both languages have strings that you
1181 need to translate or accept. The \uicontrol Strings view shows the translation
1182 acceptance state of each string for each language.
1183*/
1184
1185/*!
1186 \page linguist-programmers.html
1187 \title Developers
1188
1189 \previouspage Translating multiple languages simultaneously
1190 \nextpage TS File Format
1191
1192 \image front-coding.png
1193
1194 Design your application so that it can be adapted to various languages and
1195 regions without engineering changes.
1196
1197 \list
1198 \li \l{TS file format}
1199 \li \l{Text ID based translations}
1200 \li \l{CMake Commands in Qt6 LinguistTools}{CMake commands}
1201 \li \l{Examples}
1202 \endlist
1203
1204 For more information, see also:
1205 \list
1206 \li \l {Internationalization with Qt}
1207 \li \l {Writing Source Code for Translation}
1208 \li \l {Localizing Applications}.
1209 \endlist
1210
1211 You can use Qt Creator wizard templates to create Qt widget-based projects
1212 with translation support. For more information, see
1213 \l {Qt Creator: Creating Projects}.
1214
1215 The following video shows how to internationalize and localize a simple
1216 example application:
1217
1218 \youtube xNIz78IPBu0
1219*/
1220
1221/*!
1222 \page linguist-programmers-examples.html
1223 \title Examples
1224
1225 \nextpage Developers
1226
1227 The following examples illustrate how to prepare Qt applications for
1228 translation:
1229
1230 \list
1231 \li \l{hellotr}{Hello tr()} is a C++ application that demonstrates the
1232 creation of a \l QTranslator object. It also shows the simplest use of
1233 the \c tr() function to mark user-visible source text for
1234 translation.
1235
1236 \li \l{arrowpad}{Arrow Pad} is a C++ application that demonstrates how to
1237 make the application load translations depending on the current locale.
1238 It also shows the use of the two-argument form of \c tr() which provides
1239 additional information to the translator.
1240
1241 \li \l{trollprint}{Troll Print} is a C++ application that demonstrates how
1242 to distinguish identical source text in the same context. It also shows
1243 how minimize the translator's work when an application is upgraded.
1244
1245 \li \l{Qt Quick I18N} demonstrates how to internationalize Qt Quick
1246 applications.
1247 \endlist
1248*/
1249
1250/*!
1251 \page linguist-ts-file-format.html
1252 \title TS file format
1253
1254 \previouspage Developers
1255
1256 \brief TS file format.
1257
1258 The TS file format used by \QL is described by the
1259 \l{http://www.w3.org/2001/XMLSchema}{XSD} presented below,
1260 which we include for your convenience. Be aware that the format
1261 may change in future Qt releases.
1262
1263 \quotefile ../../../shared/ts.xsd
1264
1265*/
1266
1267/*!
1268 \page linguist-id-based-i18n.html
1269 \title Text ID based translations
1270 \ingroup internationalization
1271
1272
1273 \brief Text ID based internationalization provides support for large scale
1274 projects with many target locales and many texts to translate.
1275
1276 The text ID translation mechanism is an \e {industrial strength} system for
1277 internationalization and localization. Each text in the application has a
1278 unique identifier (text ID) that you use in the source code instead of text.
1279 This makes it much easier to manage large numbers of translated texts.
1280
1281 \note You must use only plain-text-based or only text-ID-based functions in
1282 one application. If you mix them, you will end up with an incomplete set of
1283 texts to be translated.
1284
1285
1286 \section1 Internationalizing with text IDs
1287
1288 When using text IDs instead of plain text, the general method of
1289 internationalizing an application is the same but the details are a bit
1290 different:
1291
1292 \list 1
1293
1294 \li The functions and macros for the text-ID-based translation system are
1295 different from the plain-text system. You use the \c qsTrId() function instead
1296 of qsTr(), the \c QT_TRID_NOOP() macro instead of QT_TR_NOOP(),
1297 and \c QT_TRID_N_NOOP() macro instead of QT_TR_N_NOOP()).
1298
1299 \li Use text IDs as user interface strings rather than plain text
1300 strings. For example, \c {qsTrId("id-back-not-front")}
1301
1302 \li You cannot specify a context parameter with a text ID, and therefore
1303 identically spelled words with different meanings need separate
1304 text IDs. For example, \c {qsTrId("id-back-backstep")} differentiates
1305 the back-step \e {Back} from the \c id-back-not-front \e {Back}.
1306
1307 \li The \e {engineering English} text that you see in the user interface for
1308 development builds is indicated with a \c {//%} comment. If you do not
1309 include this, the text ID is shown in the user interface. This is
1310 especially important when you have texts with parameters. The \c {//%}
1311 comment needs to include the parameters indicators in the string. For
1312 example, \c {//% "Number of files: %1"}
1313
1314 \li The \c {//:} comments that provide extra information to the translator
1315 are optional in the plain-text system. However, with the text-ID-based
1316 system, this extra information becomes essential because without it you only
1317 have the text ID and the translator might not be able to make a sensible
1318 translation from that without further context. You can use long descriptive
1319 text IDs and no comments, but comments are often easier to understand.
1320
1321 \endlist
1322
1323 The side-by-side code snippets below show a comparison of text-ID -based and
1324 plain-text-based translations:
1325
1326 \table
1327 \header
1328 \li text-ID-based
1329 \li plain-text-based
1330 \row
1331 \li
1332 \code
1333 Text {
1334 id: backTxt;
1335 //: The back of the object, not the front
1336 //% "Back"
1337 //~ Context Not related to back-stepping
1338 text: qsTrId("id-back-not-front");
1339 }
1340 \endcode
1341
1342 \li
1343 \code
1344 Text {
1345 id: backTxt;
1346 //: The back of the object, not the front
1347 //~ Context Not related to back-stepping
1348 text: qsTr("Back","Not front")
1349 }
1350 \endcode
1351 \endtable
1352
1353 \section1 Localizing with text IDs
1354
1355 Localizing with text IDs follows much the same process as for plain text.
1356
1357 You use the \l{Using lupdate}{lupdate} tool to generate the TS files where
1358 you add the translations. The source values in the translation files will be
1359 text IDs rather than plain text, and therefore you need either descriptive
1360 text IDs or good additional comments, or both to ensure that the translations
1361 are accurate.
1362
1363 The example text-ID-based user interface text from above results in the following
1364 content in the .ts file:
1365
1366 \code
1367 <message id="id-back-not-front">
1368 <source>Back</source>
1369 <extracomment>The back of the object, not the front</extracomment>
1370 <translation type="unfinished"></translation>
1371 <extra-Context>Not related to back-stepping</extra-Context>
1372 </message>
1373 \endcode
1374
1375 When using \l{Using lrelease}{lrelease}, you need to specify that the keys
1376 for translated texts are based on text IDs, rather than plain text. If you
1377 use \c qsTr() to mark the strings as translatable in the code, the \c id
1378 attribute is not set and \c lrelease ignores them.
1379
1380 However, if there is no translation available for a given text (which is
1381 generally the case until late in development), the text ID will be shown in
1382 the user interface rather than a proper text. In order to make the application
1383 more usable for testing, you can make \c lrelease use the \e {Engineering English}
1384 source text (from the \c {//%} comments) as the translated text and mark it with
1385 some indicator, such as an exclamation mark (!), so you can see texts that
1386 are not yet translated.
1387
1388 \section1 CMake configuration
1389
1390 When building with CMake, use the prefix \c qml_ for .ts files.
1391 For example, \c qml_en.ts. In the CMakeLists.txt file, add the
1392 \l qt_add_translations function, where you list the *.ts files
1393 as values of \c TS_FILES, set the value of RESOURCE_PREFIX to the
1394 URI of the main.qml file for the project followed by /i18n, and
1395 set the value of \c LRELEASE_OPTIONS to \c -idbased:
1396
1397 \badcode
1398 qt_add_translations(${CMAKE_PROJECT_NAME}
1399 TS_FILES i18n/qml_de_DE.ts i18n/qml_en_US.ts
1400 RESOURCE_PREFIX Main/i18n
1401 LRELEASE_OPTIONS -idbased
1402 )
1403 \endcode
1404
1405 \section1 Advanced use with qmake
1406
1407 For projects that target a large number of locales, you can remove the
1408 TRANSLATIONS info from the .pro file and, instead, manage the translations
1409 with a separate script. The script can call \c lrelease and \c lupdate for each of
1410 the desired targets.
1411
1412 The updates could be scripted something like this:
1413
1414 \code
1415 lupdate -recursive <project-dir> -ts <project-dir>/i18n/myapp-text_en_GB.ts
1416 lupdate -recursive <project-dir> -ts <project-dir>/i18n/myapp-text_en_US.ts
1417 ...
1418 \endcode
1419
1420 The generation of the final .qm files could be scripted something like this:
1421
1422 \code
1423 lrelease -idbased <project-dir>/i18n/myapp-text_en_GB.ts
1424 lrelease -idbased <project-dir>/i18n/myapp-text_en_US.ts
1425 ...
1426 \endcode
1427
1428*/