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}
}
\wxheading{See also}
-\helpref{I18n overview}{internationalization}
+\helpref{Internationalization overview}{internationalization},\\
+\helpref{Internat sample}{sampleinternat}
\wxheading{Include files}
\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:
{\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}
Note that you can call this function only if you used the form of
\helpref{Init}{wxlocaleinit} that takes wxLanguage argument.
+\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.
+
\membersection{wxLocale::GetLocale}\label{wxlocalegetlocale}
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}
}