1999-02-27 01:43:43 +00:00
|
|
|
\section{Internationalization}\label{internationalization}
|
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
Although internationalization of an application (i18n for short) involves far
|
|
|
|
more than just translating its text messages to another message -- date, time and
|
1999-02-27 01:43:43 +00:00
|
|
|
currency formats need changing too, some languages are written left to right
|
|
|
|
and others right to left, character encoding may differ and many other things
|
2000-07-15 19:51:35 +00:00
|
|
|
may need changing too -- it is a necessary first step. wxWindows provides
|
|
|
|
facilities for message translation with its
|
1999-02-27 01:43:43 +00:00
|
|
|
\helpref{wxLocale}{wxlocale} class and is itself fully translated into several
|
1999-02-28 20:59:08 +00:00
|
|
|
languages. Please consult wxWindows home page for the most up-to-date
|
|
|
|
translations - and if you translate it into one of the languages not done
|
1999-02-27 01:43:43 +00:00
|
|
|
yet, your translations would be gratefully accepted for inclusion into the
|
1999-02-28 20:59:08 +00:00
|
|
|
future versions of the library!
|
1999-02-27 01:43:43 +00:00
|
|
|
|
|
|
|
The wxWindows approach to i18n closely follows GNU gettext package. wxWindows uses the
|
|
|
|
message catalogs which are binary compatible with gettext catalogs and this
|
|
|
|
allows to use all of the programs in this package to work with them. But note
|
|
|
|
that no additional libraries are needed during the run-time, however, so you
|
|
|
|
have only the message catalogs to distribute and nothing else.
|
|
|
|
|
1999-02-28 20:59:08 +00:00
|
|
|
During program development you will need the gettext package for
|
1999-02-27 01:43:43 +00:00
|
|
|
working with message catalogs. {\bf Warning:} gettext versions < 0.10 are known
|
|
|
|
to be buggy, so you should find a later version of it!
|
|
|
|
|
|
|
|
There are two kinds of message catalogs: source catalogs which are text files
|
|
|
|
with extension .po and binary catalogs which are created from the source ones
|
2000-07-15 19:51:35 +00:00
|
|
|
with {\it msgfmt} program (part of gettext package) and have the extension .mo.
|
1999-02-27 01:43:43 +00:00
|
|
|
Only the binary files are needed during program execution.
|
|
|
|
|
|
|
|
The program i18n involves several steps:
|
|
|
|
|
|
|
|
\begin{enumerate}\itemsep=0pt
|
|
|
|
\item Translating the strings in the program text using
|
|
|
|
\helpref{wxGetTranslation}{wxgettranslation} or equivalently the \_() macro.
|
|
|
|
\item Extracting the strings to be translated from the program: this uses the
|
|
|
|
work done in the previous step because {\it xgettext} program used for string
|
1999-02-28 20:59:08 +00:00
|
|
|
extraction may be told (using its -k option) to recognise \_() and
|
1999-02-27 01:43:43 +00:00
|
|
|
wxGetTranslation and extract all strings inside the calls to these functions.
|
|
|
|
Alternatively, you may use -a option to extract all the strings, but it will
|
|
|
|
usually result in many strings being found which don't have to be translated at
|
|
|
|
all. This will create a text message catalog - a .po file.
|
|
|
|
\item Translating the strings extracted in the previous step to other
|
|
|
|
language(s). It involves editing the .po file.
|
|
|
|
\item Compiling the .po file into .mo file to be used by the program.
|
|
|
|
\item Setting the appropriate locale in your program to use the strings for the
|
|
|
|
given language: see \helpref{wxLocale}{wxlocale}.
|
|
|
|
\end{enumerate}
|
|
|
|
|
1999-02-28 20:59:08 +00:00
|
|
|
See also the GNU gettext documentation linked from {\tt docs/html/index.htm} in
|
|
|
|
your wxWindows distribution.
|
|
|
|
|
2000-03-18 09:20:21 +00:00
|
|
|
See also \helpref{Writing non-English applications}{nonenglishoverview}.
|
2000-01-19 23:07:23 +00:00
|
|
|
It focuses on handling charsets related problems.
|
|
|
|
|