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.
2001-11-23 17:08:45 -05:00
\perlnote { In wxPerl you can't use the '\_ ' function name, so
the { \tt Wx::Locale} module can export the { \tt gettext} and
{ \tt gettext\_ noop} under any given name.
2000-12-20 11:10:46 -05:00
\begin { verbatim}
2001-11-23 17:08:45 -05:00
# this imports gettext ( equivalent to Wx::GetTranslation
# and gettext_ noop ( a noop )
# into your module
use Wx::Locale qw(:default);
2000-12-20 11:10:46 -05:00
# ....
2001-11-23 17:08:45 -05:00
# use the functions
print gettext( ``Panic!'' );
2000-12-20 11:10:46 -05:00
2001-11-23 17:08:45 -05:00
button = Wx::Button->new( window, -1, gettext( ``Label'' ) );
\end { verbatim}
If you need to translate a lot of strings, then adding gettext( ) around
each one is a long task ( that is why \_ ( ) was introduced ), so just choose
a shorter name for gettext:
\begin { verbatim}
#
use Wx::Locale 'gettext' => 't',
'gettext_ noop' => 'gettext_ noop';
# ...
# use the functions
print t( ``Panic!!'' );
# ...
2000-12-20 11:10:46 -05:00
\end { verbatim}
}
1999-02-15 18:04:52 -05:00
\wxheading { Derived from}
No base class
1999-02-26 20:26:26 -05:00
\wxheading { See also}
2002-12-05 07:04:51 -05:00
\helpref { Internationalization overview} { internationalization} ,\\
\helpref { Internat sample} { sampleinternat}
1999-02-26 20:26:26 -05:00
1999-02-16 15:17:02 -05:00
\wxheading { Include files}
<wx/intl.h>
2001-01-18 19:20:49 -05:00
1999-02-15 18:04:52 -05:00
\latexignore { \rtfignore { \wxheading { Members} } }
2001-01-18 19:20:49 -05:00
\membersection { Supported languages} \label { wxlanguage}
The following wxLanguage constants may be used to specify the language
in \helpref { Init} { wxlocaleinit} and are returned by
\helpref { GetSystemLanguage} { wxlocalegetsystemlanguage} :
2001-03-25 17:19:44 -05:00
%% --- --- --- generated code begins here --- --- ---
2001-01-18 19:20:49 -05:00
%% This enum is generated by misc/languages/genlang.py
%% When making changes, please put them into misc/languages/langtabl.txt
\begin { itemize} \itemsep =0pt
2001-05-24 06:39:33 -04:00
\item wxLANGUAGE\_ DEFAULT -- user's default language as obtained from the operating system
\item wxLANGUAGE\_ UNKNOWN -- returned by \helpref { GetSystemLanguage} { wxlocalegetsystemlanguage}
2001-01-18 19:20:49 -05:00
if it fails to detect the default language
2001-05-24 06:39:33 -04:00
\item wxLANGUAGE\_ USER\_ DEFINED -- user defined languages' integer identifiers should start from
2001-01-18 19:20:49 -05:00
this
\item wxLANGUAGE\_ ABKHAZIAN
\item wxLANGUAGE\_ AFAR
\item wxLANGUAGE\_ AFRIKAANS
\item wxLANGUAGE\_ ALBANIAN
\item wxLANGUAGE\_ AMHARIC
\item wxLANGUAGE\_ ARABIC
\item wxLANGUAGE\_ ARABIC\_ ALGERIA
\item wxLANGUAGE\_ ARABIC\_ BAHRAIN
\item wxLANGUAGE\_ ARABIC\_ EGYPT
\item wxLANGUAGE\_ ARABIC\_ IRAQ
\item wxLANGUAGE\_ ARABIC\_ JORDAN
\item wxLANGUAGE\_ ARABIC\_ KUWAIT
\item wxLANGUAGE\_ ARABIC\_ LEBANON
\item wxLANGUAGE\_ ARABIC\_ LIBYA
\item wxLANGUAGE\_ ARABIC\_ MOROCCO
\item wxLANGUAGE\_ ARABIC\_ OMAN
\item wxLANGUAGE\_ ARABIC\_ QATAR
\item wxLANGUAGE\_ ARABIC\_ SAUDI\_ ARABIA
\item wxLANGUAGE\_ ARABIC\_ SUDAN
\item wxLANGUAGE\_ ARABIC\_ SYRIA
\item wxLANGUAGE\_ ARABIC\_ TUNISIA
\item wxLANGUAGE\_ ARABIC\_ UAE
\item wxLANGUAGE\_ ARABIC\_ YEMEN
\item wxLANGUAGE\_ ARMENIAN
\item wxLANGUAGE\_ ASSAMESE
\item wxLANGUAGE\_ AYMARA
\item wxLANGUAGE\_ AZERI
\item wxLANGUAGE\_ AZERI\_ CYRILLIC
\item wxLANGUAGE\_ AZERI\_ LATIN
\item wxLANGUAGE\_ BASHKIR
\item wxLANGUAGE\_ BASQUE
\item wxLANGUAGE\_ BELARUSIAN
\item wxLANGUAGE\_ BENGALI
\item wxLANGUAGE\_ BHUTANI
\item wxLANGUAGE\_ BIHARI
\item wxLANGUAGE\_ BISLAMA
\item wxLANGUAGE\_ BRETON
\item wxLANGUAGE\_ BULGARIAN
\item wxLANGUAGE\_ BURMESE
\item wxLANGUAGE\_ CAMBODIAN
\item wxLANGUAGE\_ CATALAN
\item wxLANGUAGE\_ CHINESE
\item wxLANGUAGE\_ CHINESE\_ SIMPLIFIED
\item wxLANGUAGE\_ CHINESE\_ TRADITIONAL
\item wxLANGUAGE\_ CHINESE\_ HONGKONG
\item wxLANGUAGE\_ CHINESE\_ MACAU
\item wxLANGUAGE\_ CHINESE\_ SINGAPORE
\item wxLANGUAGE\_ CHINESE\_ TAIWAN
\item wxLANGUAGE\_ CORSICAN
\item wxLANGUAGE\_ CROATIAN
\item wxLANGUAGE\_ CZECH
\item wxLANGUAGE\_ DANISH
\item wxLANGUAGE\_ DUTCH
\item wxLANGUAGE\_ DUTCH\_ BELGIAN
\item wxLANGUAGE\_ ENGLISH
\item wxLANGUAGE\_ ENGLISH\_ UK
\item wxLANGUAGE\_ ENGLISH\_ US
\item wxLANGUAGE\_ ENGLISH\_ AUSTRALIA
\item wxLANGUAGE\_ ENGLISH\_ BELIZE
\item wxLANGUAGE\_ ENGLISH\_ BOTSWANA
\item wxLANGUAGE\_ ENGLISH\_ CANADA
\item wxLANGUAGE\_ ENGLISH\_ CARIBBEAN
\item wxLANGUAGE\_ ENGLISH\_ DENMARK
\item wxLANGUAGE\_ ENGLISH\_ EIRE
\item wxLANGUAGE\_ ENGLISH\_ JAMAICA
\item wxLANGUAGE\_ ENGLISH\_ NEW\_ ZEALAND
\item wxLANGUAGE\_ ENGLISH\_ PHILIPPINES
\item wxLANGUAGE\_ ENGLISH\_ SOUTH\_ AFRICA
\item wxLANGUAGE\_ ENGLISH\_ TRINIDAD
\item wxLANGUAGE\_ ENGLISH\_ ZIMBABWE
\item wxLANGUAGE\_ ESPERANTO
\item wxLANGUAGE\_ ESTONIAN
\item wxLANGUAGE\_ FAEROESE
\item wxLANGUAGE\_ FARSI
\item wxLANGUAGE\_ FIJI
\item wxLANGUAGE\_ FINNISH
\item wxLANGUAGE\_ FRENCH
\item wxLANGUAGE\_ FRENCH\_ BELGIAN
\item wxLANGUAGE\_ FRENCH\_ CANADIAN
\item wxLANGUAGE\_ FRENCH\_ LUXEMBOURG
\item wxLANGUAGE\_ FRENCH\_ MONACO
\item wxLANGUAGE\_ FRENCH\_ SWISS
\item wxLANGUAGE\_ FRISIAN
\item wxLANGUAGE\_ GALICIAN
\item wxLANGUAGE\_ GEORGIAN
\item wxLANGUAGE\_ GERMAN
\item wxLANGUAGE\_ GERMAN\_ AUSTRIAN
\item wxLANGUAGE\_ GERMAN\_ BELGIUM
\item wxLANGUAGE\_ GERMAN\_ LIECHTENSTEIN
\item wxLANGUAGE\_ GERMAN\_ LUXEMBOURG
\item wxLANGUAGE\_ GERMAN\_ SWISS
\item wxLANGUAGE\_ GREEK
\item wxLANGUAGE\_ GREENLANDIC
\item wxLANGUAGE\_ GUARANI
\item wxLANGUAGE\_ GUJARATI
\item wxLANGUAGE\_ HAUSA
\item wxLANGUAGE\_ HEBREW
\item wxLANGUAGE\_ HINDI
\item wxLANGUAGE\_ HUNGARIAN
\item wxLANGUAGE\_ ICELANDIC
\item wxLANGUAGE\_ INDONESIAN
\item wxLANGUAGE\_ INTERLINGUA
\item wxLANGUAGE\_ INTERLINGUE
\item wxLANGUAGE\_ INUKTITUT
\item wxLANGUAGE\_ INUPIAK
\item wxLANGUAGE\_ IRISH
\item wxLANGUAGE\_ ITALIAN
\item wxLANGUAGE\_ ITALIAN\_ SWISS
\item wxLANGUAGE\_ JAPANESE
\item wxLANGUAGE\_ JAVANESE
\item wxLANGUAGE\_ KANNADA
\item wxLANGUAGE\_ KASHMIRI
\item wxLANGUAGE\_ KASHMIRI\_ INDIA
\item wxLANGUAGE\_ KAZAKH
\item wxLANGUAGE\_ KERNEWEK
\item wxLANGUAGE\_ KINYARWANDA
\item wxLANGUAGE\_ KIRGHIZ
\item wxLANGUAGE\_ KIRUNDI
\item wxLANGUAGE\_ KONKANI
\item wxLANGUAGE\_ KOREAN
\item wxLANGUAGE\_ KURDISH
\item wxLANGUAGE\_ LAOTHIAN
\item wxLANGUAGE\_ LATIN
\item wxLANGUAGE\_ LATVIAN
\item wxLANGUAGE\_ LINGALA
\item wxLANGUAGE\_ LITHUANIAN
\item wxLANGUAGE\_ MACEDONIAN
\item wxLANGUAGE\_ MALAGASY
\item wxLANGUAGE\_ MALAY
\item wxLANGUAGE\_ MALAYALAM
\item wxLANGUAGE\_ MALAY\_ BRUNEI\_ DARUSSALAM
\item wxLANGUAGE\_ MALAY\_ MALAYSIA
\item wxLANGUAGE\_ MALTESE
\item wxLANGUAGE\_ MANIPURI
\item wxLANGUAGE\_ MAORI
\item wxLANGUAGE\_ MARATHI
\item wxLANGUAGE\_ MOLDAVIAN
\item wxLANGUAGE\_ MONGOLIAN
\item wxLANGUAGE\_ NAURU
\item wxLANGUAGE\_ NEPALI
\item wxLANGUAGE\_ NEPALI\_ INDIA
\item wxLANGUAGE\_ NORWEGIAN\_ BOKMAL
\item wxLANGUAGE\_ NORWEGIAN\_ NYNORSK
\item wxLANGUAGE\_ OCCITAN
\item wxLANGUAGE\_ ORIYA
\item wxLANGUAGE\_ OROMO
\item wxLANGUAGE\_ PASHTO
\item wxLANGUAGE\_ POLISH
\item wxLANGUAGE\_ PORTUGUESE
\item wxLANGUAGE\_ PORTUGUESE\_ BRAZILIAN
\item wxLANGUAGE\_ PUNJABI
\item wxLANGUAGE\_ QUECHUA
\item wxLANGUAGE\_ RHAETO\_ ROMANCE
\item wxLANGUAGE\_ ROMANIAN
\item wxLANGUAGE\_ RUSSIAN
\item wxLANGUAGE\_ RUSSIAN\_ UKRAINE
\item wxLANGUAGE\_ SAMOAN
\item wxLANGUAGE\_ SANGHO
\item wxLANGUAGE\_ SANSKRIT
\item wxLANGUAGE\_ SCOTS\_ GAELIC
\item wxLANGUAGE\_ SERBIAN
\item wxLANGUAGE\_ SERBIAN\_ CYRILLIC
\item wxLANGUAGE\_ SERBIAN\_ LATIN
\item wxLANGUAGE\_ SERBO\_ CROATIAN
\item wxLANGUAGE\_ SESOTHO
\item wxLANGUAGE\_ SETSWANA
\item wxLANGUAGE\_ SHONA
\item wxLANGUAGE\_ SINDHI
\item wxLANGUAGE\_ SINHALESE
\item wxLANGUAGE\_ SISWATI
\item wxLANGUAGE\_ SLOVAK
\item wxLANGUAGE\_ SLOVENIAN
\item wxLANGUAGE\_ SOMALI
\item wxLANGUAGE\_ SPANISH
\item wxLANGUAGE\_ SPANISH\_ ARGENTINA
\item wxLANGUAGE\_ SPANISH\_ BOLIVIA
\item wxLANGUAGE\_ SPANISH\_ CHILE
\item wxLANGUAGE\_ SPANISH\_ COLOMBIA
\item wxLANGUAGE\_ SPANISH\_ COSTA\_ RICA
\item wxLANGUAGE\_ SPANISH\_ DOMINICAN\_ REPUBLIC
\item wxLANGUAGE\_ SPANISH\_ ECUADOR
\item wxLANGUAGE\_ SPANISH\_ EL\_ SALVADOR
\item wxLANGUAGE\_ SPANISH\_ GUATEMALA
\item wxLANGUAGE\_ SPANISH\_ HONDURAS
\item wxLANGUAGE\_ SPANISH\_ MEXICAN
\item wxLANGUAGE\_ SPANISH\_ MODERN
\item wxLANGUAGE\_ SPANISH\_ NICARAGUA
\item wxLANGUAGE\_ SPANISH\_ PANAMA
\item wxLANGUAGE\_ SPANISH\_ PARAGUAY
\item wxLANGUAGE\_ SPANISH\_ PERU
\item wxLANGUAGE\_ SPANISH\_ PUERTO\_ RICO
\item wxLANGUAGE\_ SPANISH\_ URUGUAY
\item wxLANGUAGE\_ SPANISH\_ US
\item wxLANGUAGE\_ SPANISH\_ VENEZUELA
\item wxLANGUAGE\_ SUNDANESE
\item wxLANGUAGE\_ SWAHILI
\item wxLANGUAGE\_ SWEDISH
\item wxLANGUAGE\_ SWEDISH\_ FINLAND
\item wxLANGUAGE\_ TAGALOG
\item wxLANGUAGE\_ TAJIK
\item wxLANGUAGE\_ TAMIL
\item wxLANGUAGE\_ TATAR
\item wxLANGUAGE\_ TELUGU
\item wxLANGUAGE\_ THAI
\item wxLANGUAGE\_ TIBETAN
\item wxLANGUAGE\_ TIGRINYA
\item wxLANGUAGE\_ TONGA
\item wxLANGUAGE\_ TSONGA
\item wxLANGUAGE\_ TURKISH
\item wxLANGUAGE\_ TURKMEN
\item wxLANGUAGE\_ TWI
\item wxLANGUAGE\_ UIGHUR
\item wxLANGUAGE\_ UKRAINIAN
\item wxLANGUAGE\_ URDU
\item wxLANGUAGE\_ URDU\_ INDIA
\item wxLANGUAGE\_ URDU\_ PAKISTAN
\item wxLANGUAGE\_ UZBEK
\item wxLANGUAGE\_ UZBEK\_ CYRILLIC
\item wxLANGUAGE\_ UZBEK\_ LATIN
\item wxLANGUAGE\_ VIETNAMESE
\item wxLANGUAGE\_ VOLAPUK
\item wxLANGUAGE\_ WELSH
\item wxLANGUAGE\_ WOLOF
\item wxLANGUAGE\_ XHOSA
\item wxLANGUAGE\_ YIDDISH
\item wxLANGUAGE\_ YORUBA
\item wxLANGUAGE\_ ZHUANG
\item wxLANGUAGE\_ ZULU
\end { itemize}
2001-03-25 17:19:44 -05:00
%% --- --- --- generated code ends here --- --- ---
2001-01-18 19:20:49 -05:00
1999-02-15 18:04:52 -05:00
\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
2001-01-18 19:20:49 -05:00
\func { } { wxLocale} { \param { int } { language} , \param { int } { flags =
wxLOCALE\_ LOAD\_ DEFAULT | wxLOCALE\_ CONV\_ ENCODING} }
See \helpref { Init()} { wxlocaleinit} for parameters description.
2003-01-17 19:16:34 -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
2001-01-18 19:20:49 -05:00
See \helpref { Init()} { wxlocaleinit} for parameters description.
1999-02-15 18:04:52 -05:00
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.
2001-01-18 19:20:49 -05:00
1999-02-15 18:04:52 -05:00
\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::AddCatalog} \label { wxlocaleaddcatalog}
\func { bool} { AddCatalog} { \param { const char } { *szDomain} }
2000-07-15 15:51:35 -04:00
Add a catalog for use with the current locale: it is 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.
2003-01-17 19:16:34 -05:00
Returns true if catalog was successfully loaded, false otherwise (which might
1999-02-15 18:04:52 -05:00
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()!
2001-01-18 19:20:49 -05:00
\membersection { wxLocale::AddLanguage} \label { wxlocaleaddlanguage}
2001-03-25 17:19:44 -05:00
\func { static void} { AddLanguage} { \param { const wxLanguageInfo\& } { info} }
2001-01-18 19:20:49 -05:00
Adds custom, user-defined language to the database of known languages. This
2002-06-07 16:15:28 -04:00
database is used in conjunction with the first form of
2001-01-18 19:20:49 -05:00
\helpref { Init} { wxlocaleinit} .
wxLanguageInfo is defined as follows:
\begin { verbatim}
struct WXDLLEXPORT wxLanguageInfo
{
int Language; // wxLanguage id
wxString CanonicalName; // Canonical name, e.g. fr_ FR
#ifdef _ _ WIN32_ _
wxUint32 WinLang, WinSublang; // Win32 language identifiers
// (LANG_ xxxx, SUBLANG_ xxxx)
#endif
wxString Description; // human-readable name of the language
} ;
\end { verbatim}
{ \it Language} should be greater than wxLANGUAGE\_ USER\_ DEFINED.
2001-11-23 17:08:45 -05:00
\perlnote { In wxPerl Wx::LanguageInfo has only one method:\par
Wx::LanguageInfo->new( language, canonicalName, WinLang, WinSubLang, Description )}
2001-01-18 19:20:49 -05:00
2003-02-04 11:43:10 -05:00
\membersection { wxLocale::FindLanguageInfo} { wxlocalefindlanguageinfo}
\constfunc { static wxLanguageInfo *} { FindLanguageInfo} { \param { const wxString\& } { locale} }
This function may be used to find the language description structure for the
given locale, specified either as a two letter ISO language code (for example,
"pt"), a language code followed by the country code ("pt\_ BR") or a full, human
readable, language description ("Portuguese-Brazil").
Returns the information for the given language or { \tt NULL} if this language
is unknown. Note that even if the returned pointer is valid, the caller should
{ \it not} delete it.
\wxheading { See also}
\helpref { GetLanguageInfo} { wxlocalegetlanguageinfo}
2001-01-18 19:20:49 -05:00
\membersection { wxLocale::GetCanonicalName} \label { wxlocalegetcanonicalname}
\constfunc { wxString} { GetSysName} { \void }
Returns the canonical form of current locale name. Canonical form is the
one that is used on UNIX systems: it is a two- or five-letter string in xx or
xx\_ YY format, where xx is ISO 639 code of language and YY is ISO 3166 code of
the country. Examples are "en", "en\_ GB", "en\_ US" or "fr\_ FR".
This form is internally used when looking up message catalogs.
Compare \helpref { GetSysName} { wxlocalegetsysname} .
\membersection { wxLocale::GetLanguage} \label { wxlocalegetlanguage}
\constfunc { int} { GetLanguage} { \void }
Returns \helpref { wxLanguage} { wxlanguage} constant of current language.
Note that you can call this function only if you used the form of
\helpref { Init} { wxlocaleinit} that takes wxLanguage argument.
2002-09-07 18:53:04 -04:00
\membersection { wxLocale::GetLanguageInfo} \label { wxlocalegetlanguageinfo}
\constfunc { static wxLanguageInfo *} { GetLanguageInfo} { \param { int } { lang} }
Returns a pointer to wxLanguageInfo structure containing information about the
given language or { \tt NULL} if this language is unknown. Note that even if the
returned pointer is valid, the caller should { \it not} delete it.
See \helpref { AddLanguage} { wxlocaleaddlanguage} for the wxLanguageInfo
description.
2003-06-13 06:16:19 -04:00
\membersection { wxLocale::GetLanguageName} \label { wxlocalegetlanguagename}
\constfunc { static wxString} { GetLanguageName} { \param { int } { lang} }
Returns English name of the given language or empty string if this
language is unknown.
2001-01-18 19:20:49 -05:00
2000-08-08 02:11:51 -04:00
\membersection { wxLocale::GetLocale} \label { wxlocalegetlocale}
\constfunc { const char*} { GetLocale} { \void }
Returns the locale name as passed to the constructor or
2001-01-18 19:20:49 -05:00
\helpref { Init()} { wxlocaleinit} . This is full, human-readable name,
e.g. "English" or "French".
2000-08-08 02:11:51 -04:00
\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} }
2003-10-04 18:43:46 -04:00
\constfunc { const char*} { GetString} { \param { const char } { *szOrigString} , \param { const char } { *szOrigString2} , \param { size\_ t } { n} , \param { const char } { *szDomain = NULL} }
2000-08-08 02:11:51 -04:00
Retrieves the translation for a string in all loaded domains unless the szDomain
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).
2003-10-04 18:43:46 -04:00
The second form is used when retrieving translation of string that has
different singular and plural form in English or different plural forms in some
2003-10-13 17:37:02 -04:00
other language. It takes two extra arguments: \arg { szOrigString}
parameter must contain the singular form of the string to be converted.
It is also used as the key for the search in the catalog.
The \arg { szOrigString2} parameter is the plural form (in English).
The parameter \arg { n} is used to determine the plural form. If no
message catalog is found \arg { szOrigString} is returned if `n == 1',
otherwise \arg { szOrigString2} .
See \urlref { GNU gettext manual} { http://www.gnu.org/manual/gettext/html\_ chapter/gettext\_ 10.html\# SEC150} for additional information on plural forms handling.
2003-10-04 18:43:46 -04:00
2000-08-08 02:11:51 -04:00
\wxheading { Remarks}
Domains are searched in the last to first order, i.e. catalogs
added later override those added before.
2001-01-18 19:20:49 -05:00
\membersection { wxLocale::GetSysName} \label { wxlocalegetsysname}
\constfunc { wxString} { GetSysName} { \void }
Returns current platform-specific locale name as passed to setlocale().
Compare \helpref { GetCanonicalName} { wxlocalegetcanonicalname} .
2001-05-31 16:27:37 -04:00
\membersection { wxLocale::GetSystemEncoding} \label { wxlocalegetsystemencoding}
\constfunc { static wxFontEncoding} { GetSystemEncoding} { \void }
Tries to detect the user's default font encoding.
Returns \helpref { wxFontEncoding} { wxfont} value or
{ \bf wxFONTENCODING\_ SYSTEM} if it couldn't be determined.
\membersection { wxLocale::GetSystemEncodingName} \label { wxlocalegetsystemencodingname}
\constfunc { static wxString} { GetSystemEncodingName} { \void }
Tries to detect the name of the user's default font encoding. This string isn't
particularly useful for the application as its form is platform-dependent and
so you should probably use
\helpref { GetSystemEncoding} { wxlocalegetsystemencoding} instead.
Returns a user-readable string value or an empty string if it couldn't be
determined.
2001-01-18 19:20:49 -05:00
\membersection { wxLocale::GetSystemLanguage} \label { wxlocalegetsystemlanguage}
2001-03-25 17:19:44 -05:00
\constfunc { static int} { GetSystemLanguage} { \void }
2001-01-18 19:20:49 -05:00
Tries to detect the user's default language setting.
Returns \helpref { wxLanguage} { wxlanguage} value or
{ \bf wxLANGUAGE\_ UNKNOWN} if the language-guessing algorithm failed.
1999-02-15 18:04:52 -05:00
\membersection { wxLocale::Init} \label { wxlocaleinit}
2001-01-18 19:20:49 -05:00
\func { bool} { Init} { \param { int } { language = wxLANGUAGE\_ DEFAULT} , \param { int } { flags =
wxLOCALE\_ LOAD\_ DEFAULT | wxLOCALE\_ CONV\_ ENCODING} }
2003-01-17 19:16:34 -05:00
\func { bool} { Init} { \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
2001-01-18 19:20:49 -05:00
The second form is deprecated, use the first one unless you know what you are
doing.
1999-02-16 15:17:02 -05:00
2001-01-18 19:20:49 -05:00
\wxheading { Parameters}
\docparam { language} { \helpref { wxLanguage} { wxlanguage} identifier of the locale.
wxLANGUAGE\_ DEFAULT has special meaning -- wxLocale will use system's default
language (see \helpref { GetSystemLanguage} { wxlocalegetsystemlanguage} ).}
\docparam { flags} { Combination of the following:
\begin { twocollist} \itemsep =0pt
\twocolitem { \windowstyle { wxLOCALE\_ LOAD\_ DEFAULT} } { Load the message catalog
for the given locale containing the translations of standard wxWindows messages
automatically.}
\twocolitem { \windowstyle { wxLOCALE\_ CONV\_ ENCODING} } { Automatically convert message
2002-03-15 18:29:22 -05:00
catalogs to platform's default encoding. Note that it will do only basic
2001-01-18 19:20:49 -05:00
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
2002-03-15 18:29:22 -05:00
description of this behaviour. Note that this flag is meaningless in Unicode build.}
2001-01-18 19:20:49 -05:00
\end { twocollist}
}
\docparam { szName} { The name of the locale. Only used in diagnostic messages.}
\docparam { szShort} { The standard 2 letter locale abbreviation and is used as the
directory prefix when looking for the message catalog files.}
\docparam { szLocale} { The parameter for the call to setlocale(). Note that it is
platform-specific.}
2003-01-17 19:16:34 -05:00
\docparam { bLoadDefault} { May be set to false to prevent loading of the message catalog
1999-02-15 18:04:52 -05:00
for the given locale containing the translations of standard wxWindows messages.
2001-01-18 19:20:49 -05:00
This parameter would be rarely used in normal circumstances.}
2003-01-17 19:16:34 -05:00
\docparam { bConvertEncoding} { May be set to true to do automatic conversion of message
2001-01-01 06:32:56 -05:00
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
2001-01-18 19:20:49 -05:00
description of this behaviour.}
1999-02-15 18:04:52 -05:00
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.
2003-01-17 19:16:34 -05:00
Returns true on success or false if the given locale couldn't be set.
1999-02-15 18:04:52 -05:00
\membersection { wxLocale::IsLoaded} \label { wxlocaleisloaded}
1999-02-16 15:17:02 -05:00
\constfunc { bool} { IsLoaded} { \param { const char* } { domain} }
2003-01-17 19:16:34 -05:00
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}
2000-08-08 02:11:51 -04:00
\membersection { wxLocale::IsOk} \label { wxlocaleisok}
1999-02-15 18:04:52 -05:00
2000-08-08 02:11:51 -04:00
\constfunc { bool} { IsOk} { \void }
1999-02-16 15:17:02 -05:00
2003-01-17 19:16:34 -05:00
Returns true if the locale could be set successfully.
1999-02-16 15:17:02 -05:00