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

Translating Themes

Translatable themes are processed with theme_lupdate. This script is similar in operation to nct_lupdate but it is specially designed to handle the specific elements of themes.

A translatable theme configuration file is a QSettings-format file so it matches the other files that nct_lupdate handles.

The .xml files in a theme are parsed for constructs like this:

    <text name="calls" size="7" rect="8,44,70x36" color="HighlightedText" format="RichText" align="hcenter" interactive="yes">
        <tr><trtext>%1 missed call(s)</trtext><trarg>@/Communications/Calls/MissedCalls</trarg></tr>
    </text>

The important part is the tags between <tr> and </tr>. The <trtext> tag is used as the translation source. The <trarg> part is not translated. It is present so that the positional %1 can be replaced. It is similar to the QString::arg() function.

    int count = 2;
    QString string = tr("%1 missed call(s)").arg(count);

See also Tasks, Internationalization (build system), and Non-code Translatables.


Copyright © 2009 Trolltech
Qt Extended - Build System Documentation