X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc81d32f2bf8c159f3b1bf6ddaf62e6d77720209..751731864888f00e31e6dce1092ac28a1fac5358:/docs/latex/wx/locale.tex diff --git a/docs/latex/wx/locale.tex b/docs/latex/wx/locale.tex index fe59e6e09e..e245495c15 100644 --- a/docs/latex/wx/locale.tex +++ b/docs/latex/wx/locale.tex @@ -3,12 +3,13 @@ wxLocale class encapsulates all language-dependent settings and is a generalization of the C locale concept. -In wxWindows this class manages message catalogs which contain the translations +In wxWidgets this class manages message catalogs which contain the translations of the strings used to the current language. \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. + \begin{verbatim} # this imports gettext ( equivalent to Wx::GetTranslation # and gettext_noop ( a noop ) @@ -22,9 +23,11 @@ the {\tt Wx::Locale} module can export the {\tt gettext} and 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', @@ -37,7 +40,7 @@ a shorter name for gettext: # ... \end{verbatim} -} +}% \wxheading{Derived from} @@ -395,6 +398,22 @@ struct WXDLLEXPORT wxLanguageInfo \perlnote{In wxPerl Wx::LanguageInfo has only one method:\par Wx::LanguageInfo->new( language, canonicalName, WinLang, WinSubLang, Description )} +\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} \membersection{wxLocale::GetCanonicalName}\label{wxlocalegetcanonicalname} @@ -430,6 +449,13 @@ returned pointer is valid, the caller should {\it not} delete it. See \helpref{AddLanguage}{wxlocaleaddlanguage} for the wxLanguageInfo description. +\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. + \membersection{wxLocale::GetLocale}\label{wxlocalegetlocale} @@ -451,6 +477,8 @@ the Init() function). \constfunc{const char*}{GetString}{\param{const char }{*szOrigString}, \param{const char }{*szDomain = NULL}} +\constfunc{const char*}{GetString}{\param{const char }{*szOrigString}, \param{const char }{*szOrigString2}, \param{size\_t }{n}, \param{const char }{*szDomain = NULL}} + Retrieves the translation for a string in all loaded domains unless the szDomain parameter is specified (and then only this catalog/domain is searched). @@ -458,6 +486,17 @@ 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). +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 +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. + \wxheading{Remarks} Domains are searched in the last to first order, i.e. catalogs @@ -520,9 +559,11 @@ 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 +for the given locale containing the translations of standard wxWidgets messages automatically.} \twocolitem{\windowstyle{wxLOCALE\_CONV\_ENCODING}}{Automatically convert message catalogs to platform's default encoding. Note that it will do only basic @@ -541,7 +582,7 @@ directory prefix when looking for the message catalog files.} platform-specific.} \docparam{bLoadDefault}{May be set to false to prevent loading of the message catalog -for the given locale containing the translations of standard wxWindows messages. +for the given locale containing the translations of standard wxWidgets messages. This parameter would be rarely used in normal circumstances.} \docparam{bConvertEncoding}{May be set to true to do automatic conversion of message