X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9005a56e5eedb4d032b05b5832633e700c6f0aba..53adbc34a2e20614c9bb6cd1ef826d3e53544e35:/docs/latex/wx/tnoneng.tex

diff --git a/docs/latex/wx/tnoneng.tex b/docs/latex/wx/tnoneng.tex
index 1ea38c589a..e4b22730be 100644
--- a/docs/latex/wx/tnoneng.tex
+++ b/docs/latex/wx/tnoneng.tex
@@ -11,26 +11,119 @@ identical, only differently encoded, packages with your application
 to this mechanism you can distribute only let's say iso8859-13 data 
 and it will be handled transparently under all systems.
 
-Please read \helpref{Internationalization}\label{internationalization} which
+Please read \helpref{Internationalization}{internationalization} which
 describes locales concept.
 
 Whereever in the following text {\it iso8859-2} and {\it windows-1250} are
 used, any encodings are meant and any encodings may be substituted there.
 
-
 \wxheading{Locales}
 
-TODO
+The best way how to ensure correctly displayed texts in GUI across platforms
+is to use locales. Write your in-code messages in English or without 
+diacritics and put real messages into message catalog (see 
+\helpref{Internationalization}{internationalization}).
 
-\wxheading{Converting data}
+Standard .po file begins with a header like this:
+
+\begin{verbatim}
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 1999-02-19 16:03+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: ENCODING\n"
+\end{verbatim}
+
+Notice these two lines:
+
+\begin{verbatim}
+#, fuzzy
+"Content-Type: text/plain; charset=CHARSET\n"
+\end{verbatim}
+
+The first tells {\it msgfmt} compiler not to include string "" (empty)
+to compiled .mo catalog. Second one informs about charset used to write
+translated messages.
 
-before storing / after loading
+You have to do 2 things: fill-in proper charset information and delete
+the {\tt fuzzy} line. Your .po file may look like this after doing so:
 
-TODO
+\begin{verbatim}
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 1999-02-19 16:03+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso8859-2\n"
+"Content-Transfer-Encoding: ENCODING\n"
+\end{verbatim}
+
+wxWindows is able to use this catalog under any supported platform
+(although iso8859-2 is Unix encoding and is not understood by Windows).
+
+How is this done? When you tell wxLocale class to load message catalog that
+contains the header (msgid "". Normal .mo catalogs do {\bf not} contain it,
+you must remove the line with {\it fuzzy}!), it checks the charset. If the
+charset is "alien" on the platform the program is currently running (e.g.
+any of ISO encodings under Windows or CP12XX under Unix) it uses
+\helpref{wxEncodingConverter::GetPlatformEquivalents}{wxencodingconvertergetplatformequivalents}
+to obtain encoding that is more common on this platform and converts
+the message catalog to this encoding. Note that it does {\bf not} check
+for presence of this encoding! It only assumes that it is always better to
+have strings in platform native encoding than in an encoding that is rarely
+(if ever) used.
+
+The behaviour described about is disabled by default.
+You must set {\it bConvertEncoding} to TRUE in 
+\helpref{wxLocale constructor}{wxlocaledefctor} in order to enable
+runtime encoding conversion!
 
 \wxheading{Font mapping}
 
-TODO
+You can use \helpref{wxEncodingConverter}{wxencodingconverter} and
+\helpref{wxFontMapper}{wxfontmapper} to display text:
+
+\begin{verbatim}
+if (!wxTheFontMapper->IsEncodingAvailable(enc, facename))
+{
+   wxFontEncoding alternative;
+   if (wxTheFontMapper->GetAltForEncoding(enc, &alternative, 
+                                          facename, FALSE))
+   {
+       wxEncodingConverted encconv;
+       if (!encconv.Init(enc, alternative))
+           ...failure...
+       else
+           text = encconv.Convert(text);
+   }
+   else
+       ...failure...
+}
+...display text...
+\end{verbatim}
+
+\wxheading{Converting data}
+
+You may want to store all program data (created documents etc.) in
+same encoding, let's say windows1250. Obviously, the best way would
+be to use \helpref{wxEncodingConverter}{wxencodingconverter}.
 
 \wxheading{Help files}
 
@@ -51,3 +144,4 @@ Charset=iso8859-2
 
 This additional entry tells HTML help controller what encoding is used
 in contents and index tables.
+
