X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4178000933f0618d2cc9dc2f80dfed91b0c61464..aad65f130d9cb77d0e9f2b7b580c54712386f77a:/docs/latex/wx/locale.tex diff --git a/docs/latex/wx/locale.tex b/docs/latex/wx/locale.tex index f82583c617..efad35bee0 100644 --- a/docs/latex/wx/locale.tex +++ b/docs/latex/wx/locale.tex @@ -6,16 +6,36 @@ generalization of the C locale concept. In wxWindows this class manages message catalogs which contain the translations of the strings used to the current language. -\perlnote{In wxPerl the {\tt Wx} module exports a '_' function -that corresponds to the '_' C++ macro. +\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} - use Wx qw(_); + # this imports gettext ( equivalent to Wx::GetTranslation + # and gettext_noop ( a noop ) + # into your module + use Wx::Locale qw(:default); # .... - print _( ``Panic!'' ); + # use the functions + print gettext( ``Panic!'' ); - my( \$button ) = Wx::Button->new( \$window, -1, _( ``Label'' ) ); + 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!!'' ); + + # ... \end{verbatim} } @@ -48,10 +68,10 @@ in \helpref{Init}{wxlocaleinit} and are returned by %% This enum is generated by misc/languages/genlang.py %% When making changes, please put them into misc/languages/langtabl.txt \begin{itemize}\itemsep=0pt -\item wxLANGUAGE_DEFAULT -- user's default language as obtained from the operating system -\item wxLANGUAGE_UNKNOWN -- returned by \helpref{GetSystemLanguage}{wxlocalegetsystemlanguage} +\item wxLANGUAGE\_DEFAULT -- user's default language as obtained from the operating system +\item wxLANGUAGE\_UNKNOWN -- returned by \helpref{GetSystemLanguage}{wxlocalegetsystemlanguage} if it fails to detect the default language -\item wxLANGUAGE_USER_DEFINED -- user defined languages' integer identifiers should start from +\item wxLANGUAGE\_USER\_DEFINED -- user defined languages' integer identifiers should start from this \item wxLANGUAGE\_ABKHAZIAN \item wxLANGUAGE\_AFAR @@ -350,7 +370,7 @@ This only applies to subsequent invocations of AddCatalog()! \func{static void}{AddLanguage}{\param{const wxLanguageInfo\& }{info}} Adds custom, user-defined language to the database of known languages. This -database is used in conjuction with the first form of +database is used in conjunction with the first form of \helpref{Init}{wxlocaleinit}. wxLanguageInfo is defined as follows: @@ -371,6 +391,8 @@ struct WXDLLEXPORT wxLanguageInfo {\it Language} should be greater than wxLANGUAGE\_USER\_DEFINED. +\perlnote{In wxPerl Wx::LanguageInfo has only one method:\par +Wx::LanguageInfo->new( language, canonicalName, WinLang, WinSubLang, Description )} \membersection{wxLocale::GetCanonicalName}\label{wxlocalegetcanonicalname} @@ -438,6 +460,26 @@ Returns current platform-specific locale name as passed to setlocale(). Compare \helpref{GetCanonicalName}{wxlocalegetcanonicalname}. +\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. + \membersection{wxLocale::GetSystemLanguage}\label{wxlocalegetsystemlanguage} \constfunc{static int}{GetSystemLanguage}{\void} @@ -471,10 +513,10 @@ language (see \helpref{GetSystemLanguage}{wxlocalegetsystemlanguage}).} for the given locale containing the translations of standard wxWindows messages automatically.} \twocolitem{\windowstyle{wxLOCALE\_CONV\_ENCODING}}{Automatically convert message -catalogs to platform's native encoding. Note that it will do only basic +catalogs to platform's default 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 -description of this behaviour.} +description of this behaviour. Note that this flag is meaningless in Unicode build.} \end{twocollist} }