Specifications
SHARP CORPORATION
Sharp SL-series Zaurus “Qtopia” Development Start-up Guide
Ver 1.11, February 28, 2003, 21/63
2.2.6. Tools for multi-language support
The following are the tools used to support multi-languages:
findtr
The “findtr” a tool is to find string(s) enclosed by tr() (such as
QObject::tr(
“
this is a test string.
”
)
),
and output to *.po file. The following is an example on using this tool:
$ findtr test.cpp > test.po
This *.po file includes the header part and string setting part. The most important portion in the header part is the
line specifying the character code. You will find the following line in the .po file. Make sure that you apply the
same encoding to the .po file with the one specified by this
charset
.
“
ContentType=
~
charset=****¥n
”
As to the string setting part, you will see a file name, line number, and the original string. You may want to set the
translations corresponding to the original string(s). The translation should be edited to
msgstr
.
#: test.cpp:36
msgid “test::this is a test”
msgstr “” //translations here
Once the .op file is created, you may want to use “msg2qm” tool to convert it to the translation file. (see below for
how to use this tool.)
msg2qm
The “msg2qm” is a tool to convert *.po file(s) to *.qm file(s). The following is an example for how to use this tool:
$ msg2qm test.po > test.qm
In order to use this translation file (*.qm file), you would have to add certain procedure at the beginning of the
application start routine. The following is an example for how to add this procedure.
int main( int argc, char *argv[] )
{
QPEApplication app( argc, argv );
QTranslator translator( 0 );
translator.load( “test.qm” );
app.installTranslator( &translator );
…
}