diff options
Diffstat (limited to 'doc/html/linguist-manual-4.html')
-rw-r--r-- | doc/html/linguist-manual-4.html | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/doc/html/linguist-manual-4.html b/doc/html/linguist-manual-4.html index 7677a1e80..2a462917f 100644 --- a/doc/html/linguist-manual-4.html +++ b/doc/html/linguist-manual-4.html @@ -59,8 +59,8 @@ body { background: #ffffff; color: black; } { <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); - <a href="ntqtranslator.html">TQTranslator</a> translator( 0 ); - translator.<a href="ntqtranslator.html#load">load</a>( "tt1_la", "." ); + <a href="tqtranslator.html">TQTranslator</a> translator( 0 ); + translator.<a href="tqtranslator.html#load">load</a>( "tt1_la", "." ); app.<a href="ntqapplication.html#installTranslator">installTranslator</a>( &translator ); </pre> <p>For a translation-aware application a translator object is created, a translation is loaded and the translator object installed into the application.</p> @@ -68,8 +68,8 @@ body { background: #ffffff; color: black; } { <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); - <a href="ntqtranslator.html">TQTranslator</a> translator( 0 ); - translator.<a href="ntqtranslator.html#load">load</a>( TQString("tt2_") + TQTextCodec::locale(), "." ); + <a href="tqtranslator.html">TQTranslator</a> translator( 0 ); + translator.<a href="tqtranslator.html#load">load</a>( TQString("tt2_") + TQTextCodec::locale(), "." ); app.<a href="ntqapplication.html#installTranslator">installTranslator</a>( &translator ); </pre> <p>In production applications a more flexible approach, for example, loading translations according to locale, might be more appropriate. If the <tt>.ts</tt> files are all named according to a convention such as <em>appname_locale</em>, e.g. <tt>tt2_fr</tt>, <tt>tt2_de</tt> etc, then the code above will load the current locale's translation at runtime.</p> @@ -172,7 +172,7 @@ body { background: #ffffff; color: black; } } </pre> <h3><a name="2"></a>Tutorials</h3> -<p>Three tutorials are presented. The first demonstrates the creation of a <a href="ntqtranslator.html">TQTranslator</a> object. It also shows the simplest use of the <tt>tr()</tt> function to mark user-visible source text for translation. The second tutorial explains how to make the application load the translation file applicable to the current locale. It also shows the use of the two-argument form of <tt>tr()</tt> which provides additional information to the translator. The third tutorial explains how identical source texts can be distinguished even when they occur in the same context. This tutorial also discusses how the translation tools help minimize the translator's work when an application is upgraded.</p> +<p>Three tutorials are presented. The first demonstrates the creation of a <a href="tqtranslator.html">TQTranslator</a> object. It also shows the simplest use of the <tt>tr()</tt> function to mark user-visible source text for translation. The second tutorial explains how to make the application load the translation file applicable to the current locale. It also shows the use of the two-argument form of <tt>tr()</tt> which provides additional information to the translator. The third tutorial explains how identical source texts can be distinguished even when they occur in the same context. This tutorial also discusses how the translation tools help minimize the translator's work when an application is upgraded.</p> <h4><a name="2-1"></a>Tutorial 1: Loading and Using Translations</h4> <p align="center"><img align="middle" src="tt1_en.png" width="112" height="49"> </p> @@ -191,15 +191,15 @@ TRANSLATIONS = tt1_la.ts #include <<a href="qapplication-h.html">ntqapplication.h</a>> #include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> -#include <<a href="qtranslator-h.html">ntqtranslator.h</a>> +#include <<a href="tqtranslator-h.html">tqtranslator.h</a>> int main( int argc, char **argv ) { <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); - <a href="ntqtranslator.html">TQTranslator</a> translator( 0 ); - translator.<a href="ntqtranslator.html#load">load</a>( "tt1_la", "." ); + <a href="tqtranslator.html">TQTranslator</a> translator( 0 ); + translator.<a href="tqtranslator.html#load">load</a>( "tt1_la", "." ); app.<a href="ntqapplication.html#installTranslator">installTranslator</a>( &translator ); <a href="ntqpushbutton.html">TQPushButton</a> hello( TQPushButton::<a href="tqobject.html#tr">tr</a>("Hello world!"), 0 ); @@ -212,13 +212,13 @@ int main( int argc, char **argv ) <blockquote><p align="center"><em><tt>main.cpp</tt></em></p></blockquote> <p>This example is a reworking of the <a href="tutorial1-01.html">"hello-world"</a> example from <a href="tutorial.html">Tutorial #1</a>, with a Latin translation. The <em>Tutorial 1 Screenshot, English version</em>, above, shows the English version.</p> <h5><a name="2-1-1"></a>Line by Line Walk-through</h5> -<pre> #include <<a href="qtranslator-h.html">ntqtranslator.h</a>> +<pre> #include <<a href="tqtranslator-h.html">tqtranslator.h</a>> </pre> -<!-- index TQTranslator --> <p>This line includes the definition of the <a href="ntqtranslator.html">TQTranslator</a> class. Objects of this class provide translations for user-visible text.</p> -<pre> <a href="ntqtranslator.html">TQTranslator</a> translator( 0 ); +<!-- index TQTranslator --> <p>This line includes the definition of the <a href="tqtranslator.html">TQTranslator</a> class. Objects of this class provide translations for user-visible text.</p> +<pre> <a href="tqtranslator.html">TQTranslator</a> translator( 0 ); </pre> - <p>Creates a <a href="ntqtranslator.html">TQTranslator</a> object without a parent.</p> -<pre> translator.<a href="ntqtranslator.html#load">load</a>( "tt1_la", "." ); + <p>Creates a <a href="tqtranslator.html">TQTranslator</a> object without a parent.</p> +<pre> translator.<a href="tqtranslator.html#load">load</a>( "tt1_la", "." ); </pre> <!-- index tt1_la.qm --> <p>Tries to load a file called <tt>tt1_la.qm</tt> (the <tt>.qm</tt> file extension is implicit) that contains Latin translations for the source texts used in the program. No error will occur if the file is not found.</p> <!-- index TQApplication!installTranslator() --><!-- index installTranslator()!TQApplication --><pre> app.<a href="ntqapplication.html#installTranslator">installTranslator</a>( &translator ); @@ -341,8 +341,8 @@ TRANSLATIONS = tt2_fr.ts \ </pre> <p>Note the use of <tt>tr()</tt> to support different keys in other languages. "Ctrl+Q" is a good choice for Quit in English, but a Dutch translator might want to use "Ctrl+A" (for Afsluiten) and a German translator "Strg+E" (for Beenden). When using <tt>tr()</tt> for Ctrl key accelerators, the two argument form should be used with the second argument describing the function that the accelerator performs.</p> <!-- index main() --><p>Our <tt>main()</tt> function is defined in <tt>main.cpp</tt> as usual.</p> -<pre> <a href="ntqtranslator.html">TQTranslator</a> translator( 0 ); - translator.<a href="ntqtranslator.html#load">load</a>( TQString("tt2_") + TQTextCodec::locale(), "." ); +<pre> <a href="tqtranslator.html">TQTranslator</a> translator( 0 ); + translator.<a href="tqtranslator.html#load">load</a>( TQString("tt2_") + TQTextCodec::locale(), "." ); app.<a href="ntqapplication.html#installTranslator">installTranslator</a>( &translator ); </pre> <!-- index TQTextCodec!locale() --><!-- index locale()!TQTextCodec --><!-- index LANG!Environment Variable --><!-- index Environment Variables!LANG --> <p>We choose which translation to use according to the current locale. <a href="tqtextcodec.html#locale">TQTextCodec::locale</a>() can be influenced by setting the <tt>LANG</tt> environment variable, for example. Notice that the use of a naming convention that incorporates the locale for <tt>.qm</tt> message files, (and <tt>.ts</tt> files), makes it easy to implement choosing the translation file according to locale.</p> @@ -463,8 +463,8 @@ TRANSLATIONS = tt3_pt.ts <a href="tqmainwindow.html#menuBar">menuBar</a>()->insertItem( <a href="tqobject.html#tr">tr</a>("&Help"), help ); </pre> <p>We also need to translate the menu items. Note that the two argument form of <tt>tr()</tt> is used for the keyboard accelerator, "Ctrl+Q", since the second argument is the only clue the translator has to indicate what function that accelerator will perform.</p> -<pre> <a href="ntqtranslator.html">TQTranslator</a> translator( 0 ); - translator.<a href="ntqtranslator.html#load">load</a>( TQString("tt3_") + TQTextCodec::locale(), "." ); +<pre> <a href="tqtranslator.html">TQTranslator</a> translator( 0 ); + translator.<a href="tqtranslator.html#load">load</a>( TQString("tt3_") + TQTextCodec::locale(), "." ); app.<a href="ntqapplication.html#installTranslator">installTranslator</a>( &translator ); </pre> <!-- index main() --> <p>The <tt>main()</tt> function in <tt>main.cpp</tt> is the same as the one in <a href="linguist-manual-4.html#2-2">Tutorial 2</a>. In particular it chooses a translation file based on the current locale.</p> |