1999-02-15 18:04:52 -05:00
|
|
|
\section{\class{wxLocale}}\label{wxlocale}
|
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
wxLocale class encapsulates all language-dependent settings and is a
|
|
|
|
generalization of the C locale concept.
|
1999-02-15 18:04:52 -05:00
|
|
|
|
|
|
|
In wxWindows this class manages message catalogs which contain the translations
|
|
|
|
of the strings used to the current language.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
No base class
|
|
|
|
|
1999-02-26 20:26:26 -05:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{I18n overview}{internationalization}
|
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/intl.h>
|
|
|
|
|
1999-02-15 18:04:52 -05:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxLocale::wxLocale}\label{wxlocaledefctor}
|
|
|
|
|
|
|
|
\func{}{wxLocale}{\void}
|
|
|
|
|
|
|
|
This is the default constructor and it does nothing to initialize the object:
|
1999-02-16 15:17:02 -05:00
|
|
|
\helpref{Init()}{wxlocaleinit} must be used to do that.
|
1999-02-15 18:04:52 -05:00
|
|
|
|
2000-01-19 18:07:29 -05:00
|
|
|
\func{}{wxLocale}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = TRUE}, \param{bool }{bConvertEncoding = FALSE}}
|
1999-02-15 18:04:52 -05:00
|
|
|
|
|
|
|
The parameters have the following meaning:
|
|
|
|
\begin{itemize}\itemsep=0pt
|
|
|
|
\item szName is the name of the locale and is only used in diagnostic messages
|
|
|
|
\item szShort is the standard 2 letter locale abbreviation and is used as the
|
|
|
|
directory prefix when looking for the message catalog files
|
|
|
|
\item szLocale is the parameter for the call to setlocale()
|
|
|
|
\item bLoadDefault may be set to FALSE to prevent loading of the message catalog
|
|
|
|
for the given locale containing the translations of standard wxWindows messages.
|
|
|
|
This parameter would be rarely used in normal circumstances.
|
2000-01-19 18:07:29 -05:00
|
|
|
\item bConvertEncoding may be set to TRUE to do automatic conversion of message
|
|
|
|
catalogs to platform's native encoding. Note that it will do only basic
|
|
|
|
conversion between well-known pair like iso8859-1 and windows-1252 or
|
|
|
|
iso8859-2 and windows-1250.
|
|
|
|
See \helpref{Writing non-English applications}{nonenglishoverview} for detailed
|
2000-01-21 17:58:18 -05:00
|
|
|
description of this behaviour.
|
1999-02-15 18:04:52 -05:00
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
The call of this function has several global side effects which you should
|
|
|
|
understand: first of all, the application locale is changed - note that this
|
|
|
|
will affect many of standard C library functions such as printf() or strftime().
|
|
|
|
Second, this wxLocale object becomes the new current global locale for the
|
|
|
|
application and so all subsequent calls to wxGetTranslation() will try to
|
|
|
|
translate the messages using the message catalogs for this locale.
|
|
|
|
|
|
|
|
\membersection{wxLocale::\destruct{wxLocale}}\label{wxlocaledtor}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxLocale}}{\void}
|
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
The destructor, like the constructor, also has global side effects: the previously
|
1999-02-15 18:04:52 -05:00
|
|
|
set locale is restored and so the changes described in
|
|
|
|
\helpref{Init}{wxlocaleinit} documentation are rolled back.
|
|
|
|
|
|
|
|
\membersection{wxLocale::GetLocale}\label{wxlocalegetlocale}
|
|
|
|
|
|
|
|
\constfunc{const char*}{GetLocale}{\void}
|
|
|
|
|
|
|
|
Returns the locale name as passed to the constructor or
|
|
|
|
\helpref{Init()}{wxlocaleinit}.
|
|
|
|
|
|
|
|
\membersection{wxLocale::AddCatalog}\label{wxlocaleaddcatalog}
|
|
|
|
|
|
|
|
\func{bool}{AddCatalog}{\param{const char }{*szDomain}}
|
|
|
|
|
|
|
|
Add a catalog for use with the current locale: it's searched for in standard
|
1999-02-16 15:17:02 -05:00
|
|
|
places (current directory first, then the system one), but you may also prepend
|
1999-02-15 18:04:52 -05:00
|
|
|
additional directories to the search path with
|
1999-02-16 15:17:02 -05:00
|
|
|
\helpref{AddCatalogLookupPathPrefix()}{wxlocaleaddcataloglookuppathprefix}.
|
1999-02-15 18:04:52 -05:00
|
|
|
|
|
|
|
All loaded catalogs will be used for message lookup by GetString() for the
|
|
|
|
current locale.
|
|
|
|
|
|
|
|
Returns TRUE if catalog was successfully loaded, FALSE otherwise (which might
|
|
|
|
mean that the catalog is not found or that it isn't in the correct format).
|
|
|
|
|
|
|
|
\membersection{wxLocale::AddCatalogLookupPathPrefix}\label{wxlocaleaddcataloglookuppathprefix}
|
|
|
|
|
|
|
|
\func{void}{AddCatalogLookupPathPrefix}{\param{const wxString\& }{prefix}}
|
|
|
|
|
|
|
|
Add a prefix to the catalog lookup path: the message catalog files will be
|
|
|
|
looked up under prefix/<lang>/LC\_MESSAGES, prefix/LC\_MESSAGES and prefix
|
|
|
|
(in this order).
|
|
|
|
|
|
|
|
This only applies to subsequent invocations of AddCatalog()!
|
|
|
|
|
|
|
|
\membersection{wxLocale::Init}\label{wxlocaleinit}
|
|
|
|
|
|
|
|
\func{bool}{Init}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = TRUE}}
|
|
|
|
|
|
|
|
The parameters have the following meaning:
|
1999-02-16 15:17:02 -05:00
|
|
|
|
1999-02-15 18:04:52 -05:00
|
|
|
\begin{itemize}\itemsep=0pt
|
|
|
|
\item szName is the name of the locale and is only used in diagnostic messages
|
|
|
|
\item szShort is the standard 2 letter locale abbreviation and is used as the
|
|
|
|
directory prefix when looking for the message catalog files
|
|
|
|
\item szLocale is the parameter for the call to setlocale()
|
|
|
|
\item bLoadDefault may be set to FALSE to prevent loading of the message catalog
|
|
|
|
for the given locale containing the translations of standard wxWindows messages.
|
|
|
|
This parameter would be rarely used in normal circumstances.
|
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
The call of this function has several global side effects which you should
|
|
|
|
understand: first of all, the application locale is changed - note that this
|
|
|
|
will affect many of standard C library functions such as printf() or strftime().
|
|
|
|
Second, this wxLocale object becomes the new current global locale for the
|
|
|
|
application and so all subsequent calls to wxGetTranslation() will try to
|
|
|
|
translate the messages using the message catalogs for this locale.
|
|
|
|
|
|
|
|
Returns TRUE on success or FALSE if the given locale couldn't be set.
|
|
|
|
|
|
|
|
\membersection{wxLocale::IsLoaded}\label{wxlocaleisloaded}
|
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
\constfunc{bool}{IsLoaded}{\param{const char* }{domain}}
|
|
|
|
|
|
|
|
Check if the given catalog is loaded, and returns TRUE if it is.
|
1999-02-15 18:04:52 -05:00
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
According to GNU gettext tradition, each catalog
|
|
|
|
normally corresponds to 'domain' which is more or less the application name.
|
1999-02-15 18:04:52 -05:00
|
|
|
|
|
|
|
See also: \helpref{AddCatalog}{wxlocaleaddcatalog}
|
|
|
|
|
|
|
|
\membersection{wxLocale::GetName}\label{wxlocalegetname}
|
|
|
|
|
|
|
|
\constfunc{const wxString\&}{GetName}{\void}
|
|
|
|
|
|
|
|
Returns the current short name for the locale (as given to the constructor or
|
|
|
|
the Init() function).
|
|
|
|
|
|
|
|
\membersection{wxLocale::GetString}\label{wxlocalegetstring}
|
|
|
|
|
|
|
|
\constfunc{const char*}{GetString}{\param{const char }{*szOrigString}, \param{const char }{*szDomain = NULL}}
|
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
Retrieves the translation for a string in all loaded domains unless the szDomain
|
1999-02-15 18:04:52 -05:00
|
|
|
parameter is specified (and then only this catalog/domain is searched).
|
|
|
|
|
|
|
|
Returns original string if translation is not available
|
|
|
|
(in this case an error message is generated the first time
|
|
|
|
a string is not found; use \helpref{wxLogNull}{wxlogoverview} to suppress it).
|
|
|
|
|
1999-02-16 15:17:02 -05:00
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
Domains are searched in the last to first order, i.e. catalogs
|
1999-02-15 18:04:52 -05:00
|
|
|
added later override those added before.
|
1999-02-16 15:17:02 -05:00
|
|
|
|