Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded |
|
Qtopia can be translated into several languages. By default Qtopia ships only with English. Additional languages can be acquired from Trolltech. For further information please contact sales@trolltech.com.
Internationalizing Qtopia software is much the same as internationalizing any Qt-based software. You should be familiar with the Qt internationalization documentation, the tr() macros, Qt Linguist from Qt 3.3 or later, and the internationalization process in general before you proceed with this document.
Note that since Qt 2 does not incorporate right-to-left writing support Qtopia (which is based on Qt 2) cannot be translated into any of the languages, such as Arabic and Hebrew, that require this feature.
Adding a translation for Qtopia is easy. There are a few steps you will need to take in order to successfully translate Qtopia into your chosen language.
To translate Qtopia into an additional language you must perform the translation process described above for all the application, desktop and config files, and any help documentation that you wish to have available in that language.
You can either install Qt 3 for X11 from your linux distribution, or download the Qt 3 source, and compile it yourself. Once installed, you should have linguist, lupdate and lrelease tools available for you to use.
The first step is to run the command make lupdate in the Qtopia ($QPEDIR) directory. This makes sure all the files necessary for translation exist and are up to date.
The first step of the make lupdate process generates translation files for each language specified via Qtopia's configure option languages. The general naming convention for these files is appname-your-lang.ts.
$QPEDIR directory. Each of these config/desktop files must have a Translation group similar to the following one which can be found in $QPEDIR/apps/Applications/clock.desktop:
[Translation] File=QtopiaApplications
This causes the generation of the file QtopiaApplications.ts in $QPEDIR/i18n/your-lang. If this file already exists it will be updated without the loss of any existing content.
Running the command make lupdate will create the directory $QPEDIR/i18n/new-lang and server specific translation files (e.g. QtopiaApplications.ts which contains the translated names for Qtopia applications). In addition to these automatically generated files every language needs a .directory file. For example, the German .directory in $QPEDIR/i18n/de begins with:
[Translation] File=QtopiaI18N Context=German [Desktop Entry] Name[]=German
This file has to be added manually after make lupdate has been executed for the first time.
The next step is to run the linguist tool. Linguist makes it easy to work with translations. It supports incremental translation, which helps you keep track of any additional content that is added to Qtopia and needs translating.
Any strings that are ambiguous or otherwise unclear or suspect in some way should be translated to whatever degree it is possible, and then left in the unfinished state.
The last step is to run the command make install in the Qtopia ($QPEDIR) directory. As part of this process lrelease is used to create Qt message files (.qm files).
Qtopia uses Helvetica as the default font. However, this font does not specify the characters for Chinese for instance.
The configuration file $QPEDIR/etc/default/FontMap.conf has to be translated so that the correct font family and size is used for each language. It defines the font which can be selected by users within Qtopia. If this configuration file is empty, Qtopia will use Helvetica font as the default font. Therefore, a valid FontMap.conf file is required to suppress Helvetica as a selectable choice. The original FontMap.conf looks like this:
[Translation] File=QtopiaDefaults Context=FontMap [Map] Font0[]=small,helvetica,10 Font1[]=normal,helvetica,12 Font2[]=large,helvetica,14
Such a configuration will be fine for most Western languages. The Map group defines three font settings that will be used by Qtopia. The first parameter in the comma separated list is the textual string that is presented to the user when s/he choses a new setting. The second parameter specifies the font family and the last parameter determines the font size.
This configuration file is marked for translation. When executing make lupdate the build system will create $QPEDIR/i18n/your-lang/QtopiaDefaults.ts. Due to its special meaning the string "small,helvetica,12" cannot be translated like any other string. A French translation may look like this:
<name>FontMap</name>
<message encoding="UTF-8">
<source>Small,helvetica,10</source>
<translation>Petit,unifont,11</translation>
</message>
Petit will be presented to the user and selecting this option will load the fontset unifont with a font size of 11.
When make install is executed the build system generates Qt message files (.qm files).
Application files must be placed as follows:
/opt/Qtopia/i18n/language/appname.qm
The language is an ISO 639 language code optionally followed by an underscore and an ISO 3166 territory. For example, "en", "en_GB", "ja", "ja_JP". The appname is the filename of the application executable.
For plugins that are shared libraries the files must be placed in the following directory:
/opt/Qtopia/i18n/language/pluginname.qm
The pluginname is the filename of the plugin shared object minus any extensions, but including "lib" if the plugin incorporates that prefix.
Locale suffixes are supported. For example, if your application uses British English it can have a /opt/Qtopia/i18n/en_US/appname.qm file specifying changes for American English. Translations with locale suffixes take precedence over translations without such suffixes.
Desktop/Config files (eg. /opt/Qtopia/apps/Application/appname.desktop) can also be translated. For example, the texteditor.desktop file begins with:
[Translation] File=QtopiaApplications Context=Notes [Desktop Entry] Comment[]=A Text Editing Program Exec=textedit Icon=TextEditor Type=Application MimeType=text/* Name[]=Notes
This causes the file /opt/Qtopia/i18n/language/QtopiaApplications.qm to be loaded (if it isn't already) and the strings marked with "[]" to be translated in the "Text Editor" context. The "bin/nct_lupdate" script can be used to maintain .ts files from .desktop files.
These files are encoded in UTF-8.
Online documentation for applications is written in the HTML subset supported by the Qt richtext widget. Such documentation files must be placed as follows:
English documentation:
/opt/Qtopia/help/html/appname-suffixes.html
Non-English documentation:
/opt/Qtopia/help/language/html/appname-suffixes.html
The -suffixes is optional. It always starts with "-" to avoid namespace conflicts.
These files are encoded in UTF-8.
Other files that are language-specific are:
Qtopia's build system makes it very easy to translate your own applications. The example application in $QPEDIR/examples/application summarizes what has to be done in order to generate .ts files. Further details on how to build and install additional Qtopia applications can be found in the build system help.
| Copyright © 2001-2005 Trolltech | Trademarks | Qtopia version 2.1.1
|