summaryrefslogtreecommitdiffstats
path: root/doc/html/linguist-manual-4.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/linguist-manual-4.html')
-rw-r--r--doc/html/linguist-manual-4.html32
1 files changed, 16 insertions, 16 deletions
diff --git a/doc/html/linguist-manual-4.html b/doc/html/linguist-manual-4.html
index 9e21faf9a..fe06608a6 100644
--- a/doc/html/linguist-manual-4.html
+++ b/doc/html/linguist-manual-4.html
@@ -51,25 +51,25 @@ body { background: #ffffff; color: black; }
<h4><a name="1-2"></a>Loading Translations</h4>
<pre> int main( int argc, char **argv )
{
- <a href="ntqapplication.html">TQApplication</a> app( argc, argv );
+ <a href="tqapplication.html">TQApplication</a> app( argc, argv );
</pre>
<!-- index main() --> <p>This is how a simple <tt>main()</tt> function of a TQt application begins.</p>
<!-- index TQTranslator!load() --><!-- index load()!TQTranslator --><!-- index TQApplication!installTranslator() --><!-- index installTranslator()!TQApplication --><pre> int main( int argc, char **argv )
{
- <a href="ntqapplication.html">TQApplication</a> app( argc, argv );
+ <a href="tqapplication.html">TQApplication</a> app( argc, argv );
<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>( &amp;translator );
+ app.<a href="tqapplication.html#installTranslator">installTranslator</a>( &amp;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>
<pre> int main( int argc, char **argv )
{
- <a href="ntqapplication.html">TQApplication</a> app( argc, argv );
+ <a href="tqapplication.html">TQApplication</a> app( argc, argv );
<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>( &amp;translator );
+ app.<a href="tqapplication.html#installTranslator">installTranslator</a>( &amp;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>
<p>If there is no translation file for the current locale the application will fall back to using the original source text.</p>
@@ -101,7 +101,7 @@ body { background: #ffffff; color: black; }
rbh = new TQRadioButton( tr("Enabled", "Hue frame"), this );
</pre>
<!-- index Ctrl Key --><p>Ctrl key accelerators are also translatable:</p>
-<pre> file-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("E&amp;xit"), tqApp, TQ_SLOT(<a href="ntqapplication.html#quit">quit</a>()),
+<pre> file-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("E&amp;xit"), tqApp, TQ_SLOT(<a href="tqapplication.html#quit">quit</a>()),
<a href="tqobject.html#tr">tr</a>("Ctrl+Q", "Quit") );
</pre>
<p>It is strongly recommended that the two argument form of <tt>tr()</tt> is used for Ctrl key accelerators. The second argument is the only clue the translator has as to the function performed by the accelerator.</p>
@@ -188,24 +188,24 @@ TRANSLATIONS = tt1_la.ts
**
****************************************************************/
-#include &lt;<a href="qapplication-h.html">ntqapplication.h</a>&gt;
+#include &lt;<a href="tqapplication-h.html">tqapplication.h</a>&gt;
#include &lt;<a href="tqpushbutton-h.html">tqpushbutton.h</a>&gt;
#include &lt;<a href="tqtranslator-h.html">tqtranslator.h</a>&gt;
int main( int argc, char **argv )
{
- <a href="ntqapplication.html">TQApplication</a> app( argc, argv );
+ <a href="tqapplication.html">TQApplication</a> app( argc, argv );
<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>( &amp;translator );
+ app.<a href="tqapplication.html#installTranslator">installTranslator</a>( &amp;translator );
<a href="tqpushbutton.html">TQPushButton</a> hello( TQPushButton::<a href="tqobject.html#tr">tr</a>("Hello world!"), 0 );
- app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &amp;hello );
+ app.<a href="tqapplication.html#setMainWidget">setMainWidget</a>( &amp;hello );
hello.<a href="tqwidget.html#show">show</a>();
- return app.<a href="ntqapplication.html#exec">exec</a>();
+ return app.<a href="tqapplication.html#exec">exec</a>();
}
</pre>
<blockquote><p align="center"><em><tt>main.cpp</tt></em></p></blockquote>
@@ -220,7 +220,7 @@ int main( int argc, char **argv )
<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>( &amp;translator );
+<!-- index TQApplication!installTranslator() --><!-- index installTranslator()!TQApplication --><pre> app.<a href="tqapplication.html#installTranslator">installTranslator</a>( &amp;translator );
</pre>
<p>Adds the translations from <tt>tt1_la.qm</tt> to the pool of translations used by the program.</p>
<!-- index Hello World --><pre> <a href="tqpushbutton.html">TQPushButton</a> hello( TQPushButton::<a href="tqobject.html#tr">tr</a>("Hello world!"), 0 );
@@ -335,14 +335,14 @@ TRANSLATIONS = tt2_fr.ts \
<pre> ArrowPad *ap = new ArrowPad( this, "arrow pad" );
</pre>
<p>We also call <tt>MainWindow::tr()</tt> twice, once for the menu item and once for the accelerator.</p>
-<!-- index Ctrl Key --><!-- index Alt Key --><pre> file-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("E&amp;xit"), tqApp, TQ_SLOT(<a href="ntqapplication.html#quit">quit</a>()),
+<!-- index Ctrl Key --><!-- index Alt Key --><pre> file-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("E&amp;xit"), tqApp, TQ_SLOT(<a href="tqapplication.html#quit">quit</a>()),
<a href="tqobject.html#tr">tr</a>("Ctrl+Q", "Quit") );
</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="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>( &amp;translator );
+ app.<a href="tqapplication.html#installTranslator">installTranslator</a>( &amp;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>
<p>If there is no <tt>.qm</tt> message file for the locale chosen the original source text will be used and no error raised.</p>
@@ -451,7 +451,7 @@ TRANSLATIONS = tt3_pt.ts
<pre> <a href="tqwidget.html#setCaption">setCaption</a>( <a href="tqobject.html#tr">tr</a>("Troll Print 1.0") );
</pre>
<p>We must translate the window's caption.</p>
-<pre> file-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("E&amp;xit"), tqApp, TQ_SLOT(<a href="ntqapplication.html#quit">quit</a>()),
+<pre> file-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("E&amp;xit"), tqApp, TQ_SLOT(<a href="tqapplication.html#quit">quit</a>()),
<a href="tqobject.html#tr">tr</a>("Ctrl+Q", "Quit") );
<a href="tqpopupmenu.html">TQPopupMenu</a> *help = new <a href="tqpopupmenu.html">TQPopupMenu</a>( this );
help-&gt;<a href="tqmenudata.html#insertItem">insertItem</a>( <a href="tqobject.html#tr">tr</a>("&amp;About"), this, TQ_SLOT(about()), Key_F1 );
@@ -464,7 +464,7 @@ TRANSLATIONS = tt3_pt.ts
<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="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>( &amp;translator );
+ app.<a href="tqapplication.html#installTranslator">installTranslator</a>( &amp;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>
<h5><a name="2-3-2"></a>Running Troll Print 1.0 in English and in Portuguese</h5>