Qt Extended Home · Build System Home · Reference · User Guide · Internals codeless banner

Non-code Translatables

Non-code translatables are processed with nct_lupdate. This script can extract data from the following formats:

A translatable settings file looks like this:

    [Translation]
    File=QtopiaApplications
    Context=Calendar
    Comment[Desktop Entry/Name]=Use soft hyphen (char U00AD) to indicate hyphenation
    [Desktop Entry]
    Comment[]=A Calendar and Scheduling Program
    Exec=datebook
    Icon=datebook/DateBook
    Type=Application
    Name[]=Cal\xad\x65n\xad\x64\x61r
    MimeType=text/x-vcalendar

This example is datebook.desktop. The important parts are the [Translation] section and the Var[]=Value lines.

    File=QtopiaApplications

This line instructs the build system to store the translations in a file called QtopiaApplications.ts. The files in Qt Extended are generally stored in a few global .ts files but third party applications will need to use their own files.

    Context=Calendar

This line specifies the context to use for the translations. When QObject::tr() is called an implicit context is used but QApplication::translate() allows the context to be set. This must be somewhat unique so that translators do not have to deal with unrelated strings when translating content.

    Comment[Desktop Entry/Name]=Use soft hyphen (char U00AD) to indicate hyphenation

This line will put a comment in the .ts file for translators. In this case, the value Name in the [Desktop Entry] section is given a comment.

    Name[]=Cal\xad\x65n\xad\x64\x61r

When Qt Extended reads this value, it will try to translate it.

See also Overviews, hint=nct, and Internationalization (build system).


Copyright © 2009 Trolltech
Qt Extended - Build System Documentation