]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/overviews/internationalization.h
For wxGTK2, link with X11 explicitly, since we use many X11 functions directly.
[wxWidgets.git] / docs / doxygen / overviews / internationalization.h
CommitLineData
15b6757b 1/////////////////////////////////////////////////////////////////////////////
a766986f 2// Name: internationalization.h
15b6757b
FM
3// Purpose: topic overview
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
15b6757b
FM
7/////////////////////////////////////////////////////////////////////////////
8
880efa2a 9/**
36c9828f 10
a766986f 11@page overview_i18n Internationalization
36c9828f 12
30738aae
FM
13@li @ref overview_i18n_intro
14@li @ref overview_i18n_menuaccel
15
16<hr>
17
18
19@section overview_i18n_intro Introduction
20
a766986f
BP
21Although internationalization of an application (i18n for short) involves far
22more than just translating its text messages to another message - date, time
23and currency formats need changing too, some languages are written left to
24right and others right to left, character encoding may differ and many other
25things may need changing too - it is a necessary first step. wxWidgets provides
26facilities for message translation with it's wxLocale class and is itself fully
27translated into several languages. Please consult wxWidgets home page for the
28most up-to-date translations - and if you translate it into one of the
29languages not done yet, your translations would be gratefully accepted for
30inclusion into future versions of the library!
31
32The wxWidgets approach to i18n closely follows the GNU gettext package.
33wxWidgets uses the message catalogs which are binary compatible with gettext
34catalogs and this allows to use all of the programs in this package to work
35with them. But note that no additional libraries are needed during run-time,
36however, so you have only the message catalogs to distribute and nothing else.
37
38During program development you will need the gettext package for working with
39message catalogs. @b Warning: gettext versions @< 0.10 are known to be buggy,
40so you should find a later version of it!
41
42There are two kinds of message catalogs: source catalogs which are text files
43with extension .po and binary catalogs which are created from the source ones
44with @e msgfmt program (part of gettext package) and have the extension .mo.
45Only the binary files are needed during program execution.
46
47Translating your application involves several steps:
48
49@li Translating the strings in the program text using wxGetTranslation or
50 equivalently the @c _() macro.
51@li Extracting the strings to be translated from the program: this uses the
52 work done in the previous step because @c xgettext program used for string
53 extraction recognises the standard @c _() as well as (using its @c -k
54 option) our wxGetTranslation and extracts all strings inside the calls to
55 these functions. Alternatively, you may use @c -a option to extract all the
56 strings, but it will usually result in many strings being found which don't
57 have to be translated at all. This will create a text message catalog - a
58 .po file.
59@li Translating the strings extracted in the previous step to other
60 language(s). It involves editing the .po file.
61@li Compiling the .po file into .mo file to be used by the program.
62@li Installing the .mo files with your application in the appropriate location
63 for the target system which is the one returned by
64 wxStandardPaths::GetLocalizedResourcesDir(
65 wxStandardPaths::ResourceCat_Messages ). If the message catalogs are not
66 installed in this default location you may explicitly use
67 wxLocale::AddCatalogLookupPathPrefix() to still allow wxWidgets to find
68 them but it is strongly recommended to use the default directory.
69@li Setting the appropriate locale in your program to use the strings for the
70 given language: see wxLocale.
71
72
73@section overview_i18n_menuaccel Translating Menu Accelerators
74
75If you translate the accelerator modifier names (Ctrl, Alt and Shift) in your
76menu labels, you may find the accelerators no longer work. In your message
77catalogs, you need to provide individual translations of these modifiers from
78their lower case names (ctrl, alt, shift) so that the wxWidgets accelerator
79code can recognise them even when translated. wxWidgets does not provide
80translations for all of these currently. wxWidgets does not yet handle
81translated special key names such as Backspace, End, Insert, etc.
82
83
adcb6f88 84@see
a766986f
BP
85@li The gettext Manual: http://www.gnu.org/software/gettext/manual/gettext.html
86@li @ref overview_nonenglish - It focuses on handling charsets related problems.
dc28cdf8 87@li @ref page_samples_internat - Shows you how all this looks in practice.
a766986f
BP
88
89*/
36c9828f 90