X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e72403492b3e78f8114d89baae6f81ea24c74647..c66c3af1353948c39b05ab03c7314d6f999419d0:/docs/latex/wx/locale.tex

diff --git a/docs/latex/wx/locale.tex b/docs/latex/wx/locale.tex
index 0fdbc1af91..e550878563 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}
 }
 
@@ -25,7 +45,8 @@ No base class
 
 \wxheading{See also}
 
-\helpref{I18n overview}{internationalization}
+\helpref{Internationalization overview}{internationalization},\\
+\helpref{Internat sample}{sampleinternat}
 
 \wxheading{Include files}
 
@@ -300,7 +321,7 @@ This is the default constructor and it does nothing to initialize the object:
 
 See \helpref{Init()}{wxlocaleinit} for parameters description.
 
-\func{}{wxLocale}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = TRUE}, \param{bool }{bConvertEncoding = FALSE}}
+\func{}{wxLocale}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = true}, \param{bool }{bConvertEncoding = false}}
 
 See \helpref{Init()}{wxlocaleinit} for parameters description.
 
@@ -332,7 +353,7 @@ additional directories to the search path with
 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
+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}
@@ -350,7 +371,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,7 +392,25 @@ 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::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}
 
@@ -396,6 +435,24 @@ 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.
 
+\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::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}
 
@@ -417,6 +474,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).
 
@@ -424,6 +483,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
@@ -438,6 +508,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}
@@ -453,7 +543,7 @@ Returns \helpref{wxLanguage}{wxlanguage} value or
 \func{bool}{Init}{\param{int }{language = wxLANGUAGE\_DEFAULT}, \param{int }{flags =
                           wxLOCALE\_LOAD\_DEFAULT | wxLOCALE\_CONV\_ENCODING}}
 
-\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}}
+\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}}
 
 The second form is deprecated, use the first one unless you know what you are
 doing. 
@@ -471,10 +561,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}
 }
 
@@ -486,11 +576,11 @@ directory prefix when looking for the message catalog files.}
 \docparam{szLocale}{The parameter for the call to setlocale(). Note that it is
 platform-specific.}
 
-\docparam{bLoadDefault}{May be set to FALSE to prevent loading of the message catalog
+\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.
 This parameter would be rarely used in normal circumstances.}
 
-\docparam{bConvertEncoding}{May be set to TRUE to do automatic conversion of message
+\docparam{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. 
@@ -505,13 +595,13 @@ 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.
+Returns true on success or false if the given locale couldn't be set.
 
 \membersection{wxLocale::IsLoaded}\label{wxlocaleisloaded}
 
 \constfunc{bool}{IsLoaded}{\param{const char* }{domain}}
 
-Check if the given catalog is loaded, and returns TRUE if it is.
+Check if the given catalog is loaded, and returns true if it is.
 
 According to GNU gettext tradition, each catalog
 normally corresponds to 'domain' which is more or less the application name.
@@ -522,5 +612,5 @@ See also: \helpref{AddCatalog}{wxlocaleaddcatalog}
 
 \constfunc{bool}{IsOk}{\void}
 
-Returns TRUE if the locale could be set successfully.
+Returns true if the locale could be set successfully.
 
