From e02e31c8b9d854cd62cbe9799228f6e08e882773 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 5 Dec 2011 22:04:08 -0600 Subject: Sync with latest script --- doc/html/linguist-manual-4.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/html/linguist-manual-4.html') diff --git a/doc/html/linguist-manual-4.html b/doc/html/linguist-manual-4.html index b31088a13..bffd3062a 100644 --- a/doc/html/linguist-manual-4.html +++ b/doc/html/linguist-manual-4.html @@ -32,11 +32,11 @@ body { background: #ffffff; color: black; }

[Prev: Translators] [Home]

Programmers

Support for multiple languages is extremely simple in TQt applications, and adds little overhead to the programmer's workload.

-

TQt minimizes the performance cost of using translations by translating the phrases for each window as they are created. In most applications the main window is created just once. Dialogs are often created once and then shown and hidden as retquired. Once the initial translation has taken place there is no further runtime overhead for the translated windows. Only those windows that are created, destroyed and subsequently created will have a translation performance cost.

-

Creating applications that can switch language at runtime is possible with TQt, but retquires a certain amount of programmer intervention and will of course incur some runtime performance cost.

+

TQt minimizes the performance cost of using translations by translating the phrases for each window as they are created. In most applications the main window is created just once. Dialogs are often created once and then shown and hidden as required. Once the initial translation has taken place there is no further runtime overhead for the translated windows. Only those windows that are created, destroyed and subsequently created will have a translation performance cost.

+

Creating applications that can switch language at runtime is possible with TQt, but requires a certain amount of programmer intervention and will of course incur some runtime performance cost.

Making the Application Translation Aware

Programmers should make their application look for and load the appropriate translation file and mark user-visible text and Ctrl keyboard accelerators as targets for translation.

-

Each piece of text that retquires translating retquires context to help the translator identify where in the program the text occurs. In the case of multiple identical texts that retquire different translations, the translator also retquires some information to disambiguate the source texts. Marking text for translation will automatically cause the class name to be used as basic context information. In some cases the programmer may be retquired to add additional information to help the translator.

+

Each piece of text that requires translating requires context to help the translator identify where in the program the text occurs. In the case of multiple identical texts that require different translations, the translator also requires some information to disambiguate the source texts. Marking text for translation will automatically cause the class name to be used as basic context information. In some cases the programmer may be required to add additional information to help the translator.

Creating Translation Files

Translation files consist of all the user-visible text and Ctrl key accelerators in an application and translations of that text. Translation files are created as follows:

  1. Run lupdate initially to generate the first set of .ts translation source files with all the user-visible text but no translations.

    @@ -447,7 +447,7 @@ TRANSLATIONS = tt3_pt.ts but = new TQRadioButton( tr("Disabled"), colors ); but->toggle(); -

    Notice the two occurrences of tr("Enabled") and of tr("Disabled") in PrintPanel. Since both "Enabled"s and "Disabled"s appear in the same context TQt Linguist will only display one occurrence of each and will use the same translations for the duplicates that it doesn't display. Whilst this is a useful timesaver, in some languages, such as Portuguese, the second occurrence retquires a separate translation. We will see how TQt Linguist can be made to display all the occurrences for separate translation shortly.

    +

    Notice the two occurrences of tr("Enabled") and of tr("Disabled") in PrintPanel. Since both "Enabled"s and "Disabled"s appear in the same context TQt Linguist will only display one occurrence of each and will use the same translations for the duplicates that it doesn't display. Whilst this is a useful timesaver, in some languages, such as Portuguese, the second occurrence requires a separate translation. We will see how TQt Linguist can be made to display all the occurrences for separate translation shortly.

    The header file for MainWindow, mainwindow.h, contains no surprises. In the implementation, mainwindow.cpp, we have some user-visible source texts that must be marked for translation.

            setCaption( tr("Troll Print 1.0") );
     
    -- cgit v1.2.1