finished non-Eng overview

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5581 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2000-01-21 22:58:18 +00:00
parent 89894079c0
commit 54cd433261
2 changed files with 107 additions and 7 deletions

View File

@@ -43,7 +43,7 @@ catalogs to platform's native encoding. Note that it will do only basic
conversion between well-known pair like iso8859-1 and windows-1252 or
iso8859-2 and windows-1250.
See \helpref{Writing non-English applications}{nonenglishoverview} for detailed
description about this behaviour.
description of this behaviour.
\end{itemize}
The call of this function has several global side effects which you should

View File

@@ -11,7 +11,7 @@ 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
@@ -20,17 +20,117 @@ 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.
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:
\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!
before storing / after loading
TODO
\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}