diff options
Diffstat (limited to 'doc/i18n.doc')
-rw-r--r-- | doc/i18n.doc | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/doc/i18n.doc b/doc/i18n.doc index 9f6dd0ac3..7af9251b2 100644 --- a/doc/i18n.doc +++ b/doc/i18n.doc @@ -130,7 +130,7 @@ don't need to have any knowledge about the writing system used in a particular language, except for the following small points: \list -\i QPainter::drawText( int x, int y, const QString &str ) will always +\i QPainter::drawText( int x, int y, const TQString &str ) will always draw the string with it's left edge at the position specified with the x, y parameters. This will usually give you left aligned strings. Arabic and Hebrew application strings are usually right @@ -158,20 +158,20 @@ Writing multi-platform international software with TQt is a gentle, incremental process. Your software can become internationalized in the following stages: -\section2 Use QString for all User-visible Text +\section2 Use TQString for all User-visible Text -Since QString uses the Unicode encoding internally, every +Since TQString uses the Unicode encoding internally, every language in the world can be processed transparently using familiar text processing operations. Also, since all Qt -functions that present text to the user take a QString as a -parameter, there is no char* to QString conversion overhead. +functions that present text to the user take a TQString as a +parameter, there is no char* to TQString conversion overhead. -Strings that are in "programmer space" (such as QObject names -and file format texts) need not use QString; the traditional +Strings that are in "programmer space" (such as TQObject names +and file format texts) need not use TQString; the traditional char* or the QCString class will suffice. You're unlikely to notice that you are using Unicode; -QString, and QChar are just like easier versions of the crude +TQString, and TQChar are just like easier versions of the crude const char* and char from traditional C. \section2 Use tr() for all Literal Text @@ -179,8 +179,8 @@ const char* and char from traditional C. Wherever your program uses \c{"quoted text"} for text that will be presented to the user, ensure that it is processed by the \l QApplication::translate() function. Essentially all that is necessary -to achieve this is to use \l QObject::tr(). For example, assuming the -\c LoginWidget is a subclass of QWidget: +to achieve this is to use \l TQObject::tr(). For example, assuming the +\c LoginWidget is a subclass of TQWidget: \code LoginWidget::LoginWidget() @@ -194,7 +194,7 @@ This accounts for 99% of the user-visible strings you're likely to write. If the quoted text is not in a member function of a -QObject subclass, use either the tr() function of an +TQObject subclass, use either the tr() function of an appropriate class, or the QApplication::translate() function directly: @@ -221,7 +221,7 @@ The macros expand to just the text (without the context). Example of TQT_TR_NOOP(): \code - QString FriendlyConversation::greeting( int greet_type ) + TQString FriendlyConversation::greeting( int greet_type ) { static const char* greeting_strings[] = { TQT_TR_NOOP( "Hello" ), @@ -238,29 +238,29 @@ Example of TQT_TRANSLATE_NOOP(): TQT_TRANSLATE_NOOP( "FriendlyConversation", "Goodbye" ) }; - QString FriendlyConversation::greeting( int greet_type ) + TQString FriendlyConversation::greeting( int greet_type ) { return tr( greeting_strings[greet_type] ); } - QString global_greeting( int greet_type ) + TQString global_greeting( int greet_type ) { return tqApp->translate( "FriendlyConversation", greeting_strings[greet_type] ); } \endcode -If you disable the const char* to QString automatic conversion +If you disable the const char* to TQString automatic conversion by compiling your software with the macro TQT_NO_CAST_ASCII defined, you'll be very likely to catch any strings you are -missing. See QString::fromLatin1() for more information. +missing. See TQString::fromLatin1() for more information. Disabling the conversion can make programming a bit cumbersome. If your source language uses characters outside Latin-1, you -might find QObject::trUtf8() more convenient than -QObject::tr(), as tr() depends on the +might find TQObject::trUtf8() more convenient than +TQObject::tr(), as tr() depends on the QApplication::defaultCodec(), which makes it more fragile than -QObject::trUtf8(). +TQObject::trUtf8(). \section2 Use QKeySequence() for Accelerator Values @@ -275,13 +275,13 @@ it. The correct idiom is QKeySequence(tr("Ctrl+Q", "File|Quit")) ); \endcode -\section2 Use QString::arg() for Dynamic Text +\section2 Use TQString::arg() for Dynamic Text -The QString::arg() functions offer a simple means for substituting +The TQString::arg() functions offer a simple means for substituting arguments: \code void FileCopier::showProgress( int done, int total, - const QString& current_file ) + const TQString& current_file ) { label.setText( tr("%1 of %2 files copied.\nCopying: %3") .arg(done) @@ -294,8 +294,8 @@ In some languages the order of arguments may need to change, and this can easily be achieved by changing the order of the % arguments. For example: \code - QString s1 = "%1 of %2 files copied. Copying: %3"; - QString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert."; + TQString s1 = "%1 of %2 files copied. Copying: %3"; + TQString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert."; tqDebug( s1.arg(5).arg(10).arg("somefile.txt").ascii() ); tqDebug( s2.arg(5).arg(10).arg("somefile.txt").ascii() ); @@ -403,12 +403,12 @@ Typically, your application's main() function will look like this: // translation file for Qt QTranslator qt( 0 ); - qt.load( QString( "qt_" ) + QTextCodec::locale(), "." ); + qt.load( TQString( "qt_" ) + QTextCodec::locale(), "." ); app.installTranslator( &qt ); // translation file for application strings QTranslator myapp( 0 ); - myapp.load( QString( "myapp_" ) + QTextCodec::locale(), "." ); + myapp.load( TQString( "myapp_" ) + QTextCodec::locale(), "." ); app.installTranslator( &myapp ); ... @@ -432,7 +432,7 @@ need to output Cyrillic in the ISO 8859-5 encoding. Code for this would be: \code - QString string = ...; // some Unicode text + TQString string = ...; // some Unicode text QTextCodec* codec = QTextCodec::codecForName( "ISO 8859-5" ); QCString encoded_string = codec->fromUnicode( string ); @@ -441,14 +441,14 @@ would be: \endcode For converting Unicode to local 8-bit encodings, a shortcut is -available: the \link QString::local8Bit() local8Bit\endlink() method -of QString returns such 8-bit data. Another useful shortcut is the -\link QString::utf8() utf8\endlink() method, which returns text in the +available: the \link TQString::local8Bit() local8Bit\endlink() method +of TQString returns such 8-bit data. Another useful shortcut is the +\link TQString::utf8() utf8\endlink() method, which returns text in the 8-bit UTF-8 encoding: this perfectly preserves Unicode information while looking like plain US-ASCII if the text is wholly US-ASCII. -For converting the other way, there are the QString::fromUtf8() and -QString::fromLocal8Bit() convenience functions, or the general code, +For converting the other way, there are the TQString::fromUtf8() and +TQString::fromLocal8Bit() convenience functions, or the general code, demonstrated by this conversion from ISO 8859-5 Cyrillic to Unicode conversion: @@ -456,9 +456,9 @@ conversion: QCString encoded_string = ...; // Some ISO 8859-5 encoded text. QTextCodec* codec = QTextCodec::codecForName("ISO 8859-5"); - QString string = codec->toUnicode(encoded_string); + TQString string = codec->toUnicode(encoded_string); - ...; // Use string in all of Qt's QString operations. + ...; // Use string in all of Qt's TQString operations. \endcode Ideally Unicode I/O should be used as this maximizes the portability @@ -523,7 +523,7 @@ to the user's language settings while they are still running. To make widgets aware of changes to the system language, implement a public slot called \c languageChange() in each widget that needs to be notified. In this slot, you should update the text displayed by widgets using the -\l{QObject::tr()}{tr()} function in the usual way; for example: +\l{TQObject::tr()}{tr()} function in the usual way; for example: \code void MyWidget::languageChange() @@ -534,7 +534,7 @@ void MyWidget::languageChange() } \endcode -The default event handler for QWidget subclasses responds to the +The default event handler for TQWidget subclasses responds to the \link QEvent::Type LanguageChange\endlink event, and will call this slot when necessary; other application components can also connect signals to this slot to force widgets to update themselves. |