\section{Internationalization}\label{internationalization}
-Although internationalization (i18n for short) of an application involves far
-more than just translating its text messages to another message (date, time and
+Although internationalization of an application (i18n for short) involves far
+more than just translating its text messages to another message - date, time and
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
-may need changing too), it is a necessary first step. wxWindows provides
-facilities for the messages translation with its
+may need changing too - it is a necessary first step. wxWidgets provides
+facilities for message translation with its
\helpref{wxLocale}{wxlocale} class and is itself fully translated into several
-languages. Please consult wxWindows home page for the most up-to-date
+languages. Please consult wxWidgets home page for the most up-to-date
translations - and if you translate it into one of the languages not done
yet, your translations would be gratefully accepted for inclusion into the
future versions of the library!
-The wxWindows approach to i18n closely follows GNU gettext package. wxWindows uses the
+The wxWidgets approach to i18n closely follows GNU gettext package. wxWidgets 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
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
-with {\it msgfmt} program (part fo gettext package) and have the extension .mo.
+with {\it msgfmt} program (part of gettext package) and have the extension .mo.
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.
+\helpref{wxGetTranslation}{wxgettranslation} or equivalently the
+\helpref{\_()}{underscore} 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
-extraction may be told (using its -k option) to recognise \_() and
-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.
+work done in the previous step because {\tt xgettext} program used for string
+extraction recognises the standard \_() as well as (using its {\tt -k} option)
+our wxGetTranslation and extracts all strings inside the calls to these
+functions. Alternatively, you may use {\tt -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.
given language: see \helpref{wxLocale}{wxlocale}.
\end{enumerate}
+If you want your app to run under MacOS X with internationlization as
+described above you'll need to make one modification to the Info.plist
+file which describes the contents of the "application bundle". This
+file (an XML text file in UTF-8 format) should have a
+CFBundleDevelopmentRegion entry describing the language of the developer
+- mostly English - and normally MacOS X will query the bundle for the
+presence of certain resource directories to find out which languages
+are supported (e.g. the directory German.lproj for German).
+Since wxWidgets based applications don't use these directories
+for storing resource information (they store the translation in the
+mo files instead) the application needs to be told explicitly which
+langauges are supported. This is done by adding a CFBundleLocalizations
+entry to Info.plist. This can look like this:
+
+\begin{verbatim}
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleLocalizations</key>
+ <array>
+ <string>en</string>
+ <string>de</string>
+ <string>fr</string>
+ </array>
+\end{verbatim}
+
See also the GNU gettext documentation linked from {\tt docs/html/index.htm} in
-your wxWindows distribution.
+your wxWidgets distribution.
-See also
-\section{Writing non-English applications.}\label{nonenglishoverview}
+See also \helpref{Writing non-English applications}{nonenglishoverview}.
It focuses on handling charsets related problems.
+Finally, take a look at the \helpref{i18n sample}{sampleinternat} which shows
+to you how all this looks in practice.
+