]>
Commit | Line | Data |
---|---|---|
f8d8ae38 VZ |
1 | \section{Internationalization}\label{internationalization} |
2 | ||
3 | Although internationalization (i18n for short) of an application involves far | |
4 | more than just translating its text messages to another message (date, time and | |
5 | currency formats need changing too, some languages are written left to right | |
6 | and others right to left, character encoding may differ and many other things | |
7 | may need changing too), it is a necessary first step. wxWindows provides | |
8 | facilities for the messages translation with its | |
9 | \helpref{wxLocale}{wxlocale} class and is itself fully translated into several | |
2a47d3c1 JS |
10 | languages. Please consult wxWindows home page for the most up-to-date |
11 | translations - and if you translate it into one of the languages not done | |
f8d8ae38 | 12 | yet, your translations would be gratefully accepted for inclusion into the |
2a47d3c1 | 13 | future versions of the library! |
f8d8ae38 VZ |
14 | |
15 | The wxWindows approach to i18n closely follows GNU gettext package. wxWindows uses the | |
16 | message catalogs which are binary compatible with gettext catalogs and this | |
17 | allows to use all of the programs in this package to work with them. But note | |
18 | that no additional libraries are needed during the run-time, however, so you | |
19 | have only the message catalogs to distribute and nothing else. | |
20 | ||
2a47d3c1 | 21 | During program development you will need the gettext package for |
f8d8ae38 VZ |
22 | working with message catalogs. {\bf Warning:} gettext versions < 0.10 are known |
23 | to be buggy, so you should find a later version of it! | |
24 | ||
25 | There are two kinds of message catalogs: source catalogs which are text files | |
26 | with extension .po and binary catalogs which are created from the source ones | |
27 | with {\it msgfmt} program (part fo gettext package) and have the extension .mo. | |
28 | Only the binary files are needed during program execution. | |
29 | ||
30 | The program i18n involves several steps: | |
31 | ||
32 | \begin{enumerate}\itemsep=0pt | |
f8d8ae38 VZ |
33 | \item Translating the strings in the program text using |
34 | \helpref{wxGetTranslation}{wxgettranslation} or equivalently the \_() macro. | |
f8d8ae38 VZ |
35 | \item Extracting the strings to be translated from the program: this uses the |
36 | work done in the previous step because {\it xgettext} program used for string | |
2a47d3c1 | 37 | extraction may be told (using its -k option) to recognise \_() and |
f8d8ae38 VZ |
38 | wxGetTranslation and extract all strings inside the calls to these functions. |
39 | Alternatively, you may use -a option to extract all the strings, but it will | |
40 | usually result in many strings being found which don't have to be translated at | |
41 | all. This will create a text message catalog - a .po file. | |
f8d8ae38 VZ |
42 | \item Translating the strings extracted in the previous step to other |
43 | language(s). It involves editing the .po file. | |
f8d8ae38 | 44 | \item Compiling the .po file into .mo file to be used by the program. |
f8d8ae38 VZ |
45 | \item Setting the appropriate locale in your program to use the strings for the |
46 | given language: see \helpref{wxLocale}{wxlocale}. | |
f8d8ae38 VZ |
47 | \end{enumerate} |
48 | ||
2a47d3c1 JS |
49 | See also the GNU gettext documentation linked from {\tt docs/html/index.htm} in |
50 | your wxWindows distribution. | |
51 | ||
9005a56e | 52 | See also |
0d09b61a | 53 | \helpref{Writing non-English applications.}{nonenglishoverview} |
9005a56e VS |
54 | It focuses on handling charsets related problems. |
55 |