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