removed @NULL,@true,@false tags from the function prototypes; fixed * and & displacing in the prototypes; changed @param as discussed on wx-dev; use @see instead of @sa; better indentation for @returns,@remarks,@see paragraphs; other misc fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-03-09 12:33:59 +00:00
parent 0aaf0255e4
commit 4cc4bfafe5
256 changed files with 8880 additions and 10701 deletions

View File

@@ -55,8 +55,8 @@
@category{FIXME}
@seealso
@ref overview_internationalization "Internationalization overview", @ref
overview_sampleinternat "Internat sample", wxXLocale
@ref overview_internationalization, @ref overview_sampleinternat "Internat
sample", wxXLocale
*/
class wxLocale
{
@@ -64,7 +64,6 @@ public:
//@{
/**
See Init() for parameters description.
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().
@@ -79,8 +78,8 @@ public:
wxLocale(const wxString& name,
const wxString& short = wxEmptyString,
const wxString& locale = wxEmptyString,
bool bLoadDefault = @true,
bool bConvertEncoding = @false);
bool bLoadDefault = true,
bool bConvertEncoding = false);
//@}
/**
@@ -97,32 +96,25 @@ public:
places (current directory first, then the system one), but you may also prepend
additional directories to the search path with
AddCatalogLookupPathPrefix().
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
mean that the catalog is not found or that it isn't in the correct format).
The second form of this method takes two additional arguments,
@e msgIdLanguage and @e msgIdCharset.
@e msgIdLanguage specifies the language of "msgid" strings in source code
@a msgIdLanguage and @e msgIdCharset.
@a msgIdLanguage specifies the language of "msgid" strings in source code
(i.e. arguments to GetString(),
wxGetTranslation and the
_ macro). It is used if AddCatalog cannot find any
catalog for current language: if the language is same as source code language,
then strings from source code are used instead.
@e msgIdCharset lets you specify the charset used for msgids in sources
@a msgIdCharset lets you specify the charset used for msgids in sources
in case they use 8-bit characters (e.g. German or French strings). This
argument has no effect in Unicode build, because literals in sources are
Unicode strings; you have to use compiler-specific method of setting the right
charset when compiling with Unicode.
By default (i.e. when you use the first form), msgid strings are assumed
to be in English and written only using 7-bit ASCII characters.
If you have to deal with non-English strings or 8-bit characters in the source
code, see the instructions in
@ref overview_nonenglishoverview "Writing non-English applications".
@@ -137,7 +129,6 @@ public:
Add a prefix to the catalog lookup path: the message catalog files will be
looked up under prefix/lang/LC_MESSAGES, prefix/lang and prefix
(in this order).
This only applies to subsequent invocations of AddCatalog().
*/
void AddCatalogLookupPathPrefix(const wxString& prefix);
@@ -146,11 +137,8 @@ public:
Adds custom, user-defined language to the database of known languages. This
database is used in conjunction with the first form of
Init().
wxLanguageInfo is defined as follows:
@e Language should be greater than wxLANGUAGE_USER_DEFINED.
Wx::LanguageInfo-new( language, canonicalName, WinLang, WinSubLang, Description
)
*/
@@ -161,29 +149,26 @@ public:
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 @NULL if this language
is unknown. Note that even if the returned pointer is valid, the caller should
@e not delete it.
@sa GetLanguageInfo()
@see GetLanguageInfo()
*/
static wxLanguageInfo * FindLanguageInfo(const wxString& locale);
static wxLanguageInfo* FindLanguageInfo(const wxString& locale);
/**
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 GetSysName().
*/
wxString GetCanonicalName();
/**
Returns the header value for header @e header. The search for @e header is case
Returns the header value for header @e header. The search for @a header is case
sensitive. If an @e domain
is passed, this domain is searched. Else all domains will be searched until a
header has been found.
@@ -203,20 +188,17 @@ public:
Returns a pointer to wxLanguageInfo structure containing information about the
given language or @NULL if this language is unknown. Note that even if the
returned pointer is valid, the caller should @e not delete it.
See AddLanguage() for the wxLanguageInfo
description.
As with Init(), @c wxLANGUAGE_DEFAULT has the
special meaning if passed as an argument to this function and in this case the
result of GetSystemLanguage() is used.
*/
static wxLanguageInfo * GetLanguageInfo(int lang);
static wxLanguageInfo* GetLanguageInfo(int lang);
/**
Returns English name of the given language or empty string if this
language is unknown.
See GetLanguageInfo() for a remark about
special meaning of @c wxLANGUAGE_DEFAULT.
*/
@@ -239,39 +221,35 @@ public:
/**
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 wxLogNull 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: @e origString
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 @e origString2 parameter is the plural form (in English).
The parameter @e n is used to determine the plural form. If no
message catalog is found @e origString is returned if 'n == 1',
The @a origString2 parameter is the plural form (in English).
The parameter @a n is used to determine the plural form. If no
message catalog is found @a origString is returned if 'n == 1',
otherwise @e origString2.
See GNU gettext manual for additional information on plural forms handling.
This method is called by the wxGetTranslation
function and _ macro.
@remarks Domains are searched in the last to first order, i.e. catalogs
added later override those added before.
added later override those added before.
*/
const wxString GetString(const wxString& origString,
const wxString& domain = wxEmptyString);
const wxString GetString(const wxString& origString,
const wxString& origString2,
size_t n,
const wxString& domain = @NULL);
const wxString& domain = NULL);
//@}
/**
Returns current platform-specific locale name as passed to setlocale().
Compare GetCanonicalName().
*/
wxString GetSysName();
@@ -288,7 +266,6 @@ public:
particularly useful for the application as its form is platform-dependent and
so you should probably use
GetSystemEncoding() instead.
Returns a user-readable string value or an empty string if it couldn't be
determined.
*/
@@ -307,54 +284,65 @@ public:
doing.
@param language
wxLanguage identifier of the locale.
wxLANGUAGE_DEFAULT has special meaning -- wxLocale will use system's default
language (see GetSystemLanguage).
wxLanguage identifier of the locale.
wxLANGUAGE_DEFAULT has special meaning -- wxLocale will use system's
default
language (see GetSystemLanguage).
@param flags
Combination of the following:
Combination of the following:
wxLOCALE_LOAD_DEFAULT
Load the message catalog
for the given locale containing the translations of standard wxWidgets messages
automatically.
wxLOCALE_CONV_ENCODING
Automatically convert message
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 Writing non-English applications for detailed
description of this behaviour. Note that this flag is meaningless in Unicode
build.
wxLOCALE_LOAD_DEFAULT
Load the message catalog
for the given locale containing the translations of standard wxWidgets
messages
automatically.
wxLOCALE_CONV_ENCODING
Automatically convert message
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 Writing non-English applications for
detailed
description of this behaviour. Note that this flag is meaningless in
Unicode build.
@param name
The name of the locale. Only used in diagnostic messages.
The name of the locale. Only used in diagnostic messages.
@param short
The standard 2 letter locale abbreviation; it is used as the
directory prefix when looking for the message catalog files.
The standard 2 letter locale abbreviation; it is used as the
directory prefix when looking for the message catalog files.
@param locale
The parameter for the call to setlocale(). Note that it is
platform-specific.
The parameter for the call to setlocale(). Note that it is
platform-specific.
@param bLoadDefault
May be set to @false to prevent loading of the message catalog
for the given locale containing the translations of standard wxWidgets messages.
This parameter would be rarely used in normal circumstances.
May be set to @false to prevent loading of the message catalog
for the given locale containing the translations of standard wxWidgets
messages.
This parameter would be rarely used in normal circumstances.
@param 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.
See Writing non-English applications for detailed
description of this behaviour.
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.
See Writing non-English applications for detailed
description of this behaviour.
*/
bool Init(int language = wxLANGUAGE_DEFAULT,
int flags =
@@ -362,8 +350,8 @@ public:
bool Init(const wxString& name,
const wxString& short = wxEmptyString,
const wxString& locale = wxEmptyString,
bool bLoadDefault = @true,
bool bConvertEncoding = @false);
bool bLoadDefault = true,
bool bConvertEncoding = false);
//@}
/**
@@ -371,23 +359,19 @@ public:
this locale. For example in Windows 2000 and Windows XP, support for many
locales is not installed by default. Returns @true if the locale is
supported.
The argument @e lang is the wxLanguage identifier. To obtain this for a
The argument @a lang is the wxLanguage identifier. To obtain this for a
given a two letter ISO language code, use
FindLanguageInfo() to obtain its
wxLanguageInfo structure. See AddLanguage() for
the wxLanguageInfo description.
This function is new since wxWidgets version 2.7.1.
*/
static bool IsAvailable(int lang);
/**
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.
See also: AddCatalog()
*/
bool IsLoaded(const char* domain);
@@ -395,7 +379,7 @@ public:
/**
Returns @true if the locale could be set successfully.
*/
#define bool IsOk() /* implementation is private */
bool IsOk();
/**
See @ref overview_languagecodes "list of recognized language constants".
@@ -482,7 +466,7 @@ public:
*/
wxLocale();
wxLocale(wxLanguage lang);
wxLocale(const char * loc);
wxLocale(const char* loc);
//@}
/**
@@ -491,14 +475,12 @@ public:
most of the recent Unix systems (including Linux, various BSD and Mac OS X) and
Microsoft Visual C++ standard library provides a similar API starting from
version 8 (Visual Studio 2005).
If neither POSIX API nor Microsoft proprietary equivalent are available, this
class is still available but works in degraded mode: the only supported locale
is the C one and attempts to create wxXLocale object for any other locale will
fail. You can use the preprocessor macro @c wxHAS_XLOCALE_SUPPORT to
test if full xlocale API is available or only skeleton C locale support is
present.
Notice that wxXLocale is new in wxWidgets 2.9.0 and is not compiled in if
@c wxUSE_XLOCALE was set to 0 during the library compilation.
*/
@@ -534,20 +516,18 @@ public:
or
@false otherwise.
*/
#define bool IsOk() /* implementation is private */
bool IsOk();
/**
Currently the following @c _l-functions are available:
Character classification functions: @c wxIsxxx_l(), e.g.
@c wxIsalpha_l(), @c wxIslower_l() and all the others.
Character transformation functions: @c wxTolower_l() and
@c wxToupper_l()
We hope to provide many more functions (covering numbers, time and formatted
IO) in the near future.
@sa wxLocale
@see wxLocale
*/
};
@@ -567,7 +547,6 @@ size_t n) /* implementation is private */
/**
This macro doesn't do anything in the program code -- it simply expands to the
value of its argument.
However it does have a purpose which is to mark the literal strings for the
extraction into the message catalog created by @c xgettext program. Usually
this is achieved using _ but that macro not only marks
@@ -575,12 +554,12 @@ size_t n) /* implementation is private */
wxGetTranslation function call which means that it
cannot be used in some situations, notably for static array
initialization.
Here is an example which should make it more clear: suppose that you have a
static array of strings containing the weekday names and which have to be
translated (note that it is a bad example, really, as
wxDateTime already can be used to get the localized week
day names already). If you write
@code
static const char * const weekdays[] = { _("Mon"), ..., _("Sun") };
...
@@ -589,6 +568,7 @@ size_t n) /* implementation is private */
the code wouldn't compile because the function calls are forbidden in the array
initializer. So instead you should do
@code
static const char * const weekdays[] = { wxTRANSLATE("Mon"), ...,
wxTRANSLATE("Sun") };
@@ -597,53 +577,47 @@ size_t n) /* implementation is private */
@endcode
here.
Note that although the code @b would compile if you simply omit
wxTRANSLATE() in the above, it wouldn't work as expected because there would be
no translations for the weekday names in the program message catalog and
wxGetTranslation wouldn't find them.
*/
#define const wxChar * wxTRANSLATE(const char * s) /* implementation is private */
#define const wxChar* wxTRANSLATE(const char* s) /* implementation is private */
/**
This macro expands into a call to wxGetTranslation
function, so it marks the message for the extraction by @c xgettext just as
wxTRANSLATE does, but also returns the translation of
the string for the current locale during execution.
Don't confuse this macro with _T!
*/
#define const wxString _(const wxString& s) /* implementation is private */
const wxString _(const wxString& s);
//@{
/**
This function returns the translation of string @e str in the current
This function returns the translation of string @a str in the current
locale. If the string is not found in any of the loaded
message catalogs (see @ref overview_internationalization "internationalization
overview"), the
original string is returned. In debug build, an error message is logged -- this
should help to find the strings which were not yet translated. If
@e domain is specified then only that domain/catalog is searched
@a domain is specified then only that domain/catalog is searched
for a matching string. As this function
is used very often, an alternative (and also common in Unix world) syntax is
provided: the _ macro is defined to do the same thing
as wxGetTranslation.
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: as above, @e str
parameter must contain the singular form of the string to be converted and
is used as the key for the search in the catalog. The @e strPlural parameter
is the plural form (in English). The parameter @e n is used to determine the
plural form. If no message catalog is found @e str is returned if 'n == 1',
is used as the key for the search in the catalog. The @a strPlural parameter
is the plural form (in English). The parameter @a n is used to determine the
plural form. If no message catalog is found @a str is returned if 'n == 1',
otherwise @e strPlural.
See GNU gettext manual
for additional information on plural forms handling. For a shorter alternative
see the wxPLURAL macro.
Both versions call wxLocale::GetString.
Note that this function is not suitable for literal strings in Unicode
builds, since the literal strings must be enclosed into
_T or wxT macro which makes them