]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/locale.tex
Added Reset() to command line parser and called it from Parse(), so
[wxWidgets.git] / docs / latex / wx / locale.tex
CommitLineData
c1b7dab0
VZ
1\section{\class{wxLocale}}\label{wxlocale}
2
dbdb39b2
JS
3wxLocale class encapsulates all language-dependent settings and is a
4generalization of the C locale concept.
c1b7dab0
VZ
5
6In wxWindows this class manages message catalogs which contain the translations
7of the strings used to the current language.
8
9\wxheading{Derived from}
10
11No base class
12
ed93168b
VZ
13\wxheading{See also}
14
15\helpref{I18n overview}{internationalization}
16
dbdb39b2
JS
17\wxheading{Include files}
18
19<wx/intl.h>
20
c1b7dab0
VZ
21\latexignore{\rtfignore{\wxheading{Members}}}
22
23\membersection{wxLocale::wxLocale}\label{wxlocaledefctor}
24
25\func{}{wxLocale}{\void}
26
27This is the default constructor and it does nothing to initialize the object:
dbdb39b2 28\helpref{Init()}{wxlocaleinit} must be used to do that.
c1b7dab0 29
7ddef9ed 30\func{}{wxLocale}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = TRUE}, \param{bool }{bConvertEncoding = FALSE}}
c1b7dab0
VZ
31
32The parameters have the following meaning:
33\begin{itemize}\itemsep=0pt
34\item szName is the name of the locale and is only used in diagnostic messages
35\item szShort is the standard 2 letter locale abbreviation and is used as the
36directory prefix when looking for the message catalog files
37\item szLocale is the parameter for the call to setlocale()
38\item bLoadDefault may be set to FALSE to prevent loading of the message catalog
39for the given locale containing the translations of standard wxWindows messages.
40This parameter would be rarely used in normal circumstances.
7ddef9ed
VS
41\item bConvertEncoding may be set to TRUE to do automatic conversion of message
42catalogs to platform's native encoding. Note that it will do only basic
43conversion between well-known pair like iso8859-1 and windows-1252 or
44iso8859-2 and windows-1250.
45See \helpref{Writing non-English applications}{nonenglishoverview} for detailed
54cd4332 46description of this behaviour.
c1b7dab0
VZ
47\end{itemize}
48
49The call of this function has several global side effects which you should
50understand: first of all, the application locale is changed - note that this
51will affect many of standard C library functions such as printf() or strftime().
52Second, this wxLocale object becomes the new current global locale for the
53application and so all subsequent calls to wxGetTranslation() will try to
54translate the messages using the message catalogs for this locale.
55
56\membersection{wxLocale::\destruct{wxLocale}}\label{wxlocaledtor}
57
58\func{}{\destruct{wxLocale}}{\void}
59
dbdb39b2 60The destructor, like the constructor, also has global side effects: the previously
c1b7dab0
VZ
61set locale is restored and so the changes described in
62\helpref{Init}{wxlocaleinit} documentation are rolled back.
63
c1b7dab0
VZ
64\membersection{wxLocale::AddCatalog}\label{wxlocaleaddcatalog}
65
66\func{bool}{AddCatalog}{\param{const char }{*szDomain}}
67
f6bcfd97 68Add a catalog for use with the current locale: it is searched for in standard
dbdb39b2 69places (current directory first, then the system one), but you may also prepend
c1b7dab0 70additional directories to the search path with
dbdb39b2 71\helpref{AddCatalogLookupPathPrefix()}{wxlocaleaddcataloglookuppathprefix}.
c1b7dab0
VZ
72
73All loaded catalogs will be used for message lookup by GetString() for the
74current locale.
75
76Returns TRUE if catalog was successfully loaded, FALSE otherwise (which might
77mean that the catalog is not found or that it isn't in the correct format).
78
79\membersection{wxLocale::AddCatalogLookupPathPrefix}\label{wxlocaleaddcataloglookuppathprefix}
80
81\func{void}{AddCatalogLookupPathPrefix}{\param{const wxString\& }{prefix}}
82
83Add a prefix to the catalog lookup path: the message catalog files will be
84looked up under prefix/<lang>/LC\_MESSAGES, prefix/LC\_MESSAGES and prefix
85(in this order).
86
87This only applies to subsequent invocations of AddCatalog()!
88
3ca6a5f0
BP
89\membersection{wxLocale::GetLocale}\label{wxlocalegetlocale}
90
91\constfunc{const char*}{GetLocale}{\void}
92
93Returns the locale name as passed to the constructor or
94\helpref{Init()}{wxlocaleinit}.
95
96\membersection{wxLocale::GetName}\label{wxlocalegetname}
97
98\constfunc{const wxString\&}{GetName}{\void}
99
100Returns the current short name for the locale (as given to the constructor or
101the Init() function).
102
103\membersection{wxLocale::GetString}\label{wxlocalegetstring}
104
105\constfunc{const char*}{GetString}{\param{const char }{*szOrigString}, \param{const char }{*szDomain = NULL}}
106
107Retrieves the translation for a string in all loaded domains unless the szDomain
108parameter is specified (and then only this catalog/domain is searched).
109
110Returns original string if translation is not available
111(in this case an error message is generated the first time
112a string is not found; use \helpref{wxLogNull}{wxlogoverview} to suppress it).
113
114\wxheading{Remarks}
115
116Domains are searched in the last to first order, i.e. catalogs
117added later override those added before.
118
c1b7dab0
VZ
119\membersection{wxLocale::Init}\label{wxlocaleinit}
120
121\func{bool}{Init}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = TRUE}}
122
123The parameters have the following meaning:
dbdb39b2 124
c1b7dab0
VZ
125\begin{itemize}\itemsep=0pt
126\item szName is the name of the locale and is only used in diagnostic messages
127\item szShort is the standard 2 letter locale abbreviation and is used as the
128directory prefix when looking for the message catalog files
129\item szLocale is the parameter for the call to setlocale()
130\item bLoadDefault may be set to FALSE to prevent loading of the message catalog
131for the given locale containing the translations of standard wxWindows messages.
132This parameter would be rarely used in normal circumstances.
133\end{itemize}
134
135The call of this function has several global side effects which you should
136understand: first of all, the application locale is changed - note that this
137will affect many of standard C library functions such as printf() or strftime().
138Second, this wxLocale object becomes the new current global locale for the
139application and so all subsequent calls to wxGetTranslation() will try to
140translate the messages using the message catalogs for this locale.
141
142Returns TRUE on success or FALSE if the given locale couldn't be set.
143
144\membersection{wxLocale::IsLoaded}\label{wxlocaleisloaded}
145
dbdb39b2
JS
146\constfunc{bool}{IsLoaded}{\param{const char* }{domain}}
147
148Check if the given catalog is loaded, and returns TRUE if it is.
c1b7dab0 149
dbdb39b2
JS
150According to GNU gettext tradition, each catalog
151normally corresponds to 'domain' which is more or less the application name.
c1b7dab0
VZ
152
153See also: \helpref{AddCatalog}{wxlocaleaddcatalog}
154
3ca6a5f0 155\membersection{wxLocale::IsOk}\label{wxlocaleisok}
c1b7dab0 156
3ca6a5f0 157\constfunc{bool}{IsOk}{\void}
dbdb39b2 158
3ca6a5f0 159Returns TRUE if the locale could be set successfully.
dbdb39b2 160