2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: intl.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxLocale
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-12-29 09:14:39 -05:00
|
|
|
/**
|
|
|
|
This is the layout direction stored in wxLanguageInfo and returned by
|
2009-02-07 09:42:40 -05:00
|
|
|
wxApp::GetLayoutDirection(), wxWindow::GetLayoutDirection(),
|
|
|
|
wxDC::GetLayoutDirection() for RTL (right-to-left) languages support.
|
2008-12-29 09:14:39 -05:00
|
|
|
*/
|
|
|
|
enum wxLayoutDirection
|
|
|
|
{
|
|
|
|
wxLayout_Default,
|
|
|
|
wxLayout_LeftToRight,
|
|
|
|
wxLayout_RightToLeft
|
|
|
|
};
|
|
|
|
|
2008-10-17 16:27:36 -04:00
|
|
|
/**
|
2012-02-23 08:56:10 -05:00
|
|
|
Encapsulates a ::wxLanguage identifier together with OS-specific information
|
2009-03-19 11:08:49 -04:00
|
|
|
related to that language.
|
2009-10-18 13:47:01 -04:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl @c Wx::LanguageInfo has only one method:
|
|
|
|
- Wx::LanguageInfo->new(language, canonicalName, WinLang, WinSubLang, Description)
|
|
|
|
@endWxPerlOnly
|
2008-10-17 16:27:36 -04:00
|
|
|
*/
|
2011-10-17 14:53:28 -04:00
|
|
|
struct wxLanguageInfo
|
2008-10-17 16:27:36 -04:00
|
|
|
{
|
2009-03-29 13:15:43 -04:00
|
|
|
/// ::wxLanguage id.
|
2009-03-19 11:08:49 -04:00
|
|
|
/// It should be greater than @c wxLANGUAGE_USER_DEFINED when defining your own
|
|
|
|
/// language info structure.
|
2008-10-17 16:27:36 -04:00
|
|
|
int Language;
|
2009-02-07 10:09:48 -05:00
|
|
|
|
|
|
|
/// Canonical name of the language, e.g. @c fr_FR.
|
|
|
|
wxString CanonicalName;
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Win32 language identifiers (LANG_xxxx, SUBLANG_xxxx).
|
|
|
|
|
|
|
|
@onlyfor{wxmsw}
|
|
|
|
*/
|
|
|
|
wxUint32 WinLang, WinSublang;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/// Human-readable name of the language.
|
|
|
|
wxString Description;
|
|
|
|
|
|
|
|
/// The layout direction used for this language.
|
2008-10-17 16:27:36 -04:00
|
|
|
wxLayoutDirection LayoutDirection;
|
|
|
|
|
|
|
|
/// Return the LCID corresponding to this language.
|
2009-02-07 10:09:48 -05:00
|
|
|
/// @onlyfor{wxmsw}
|
2008-10-17 16:27:36 -04:00
|
|
|
wxUint32 GetLCID() const;
|
|
|
|
|
|
|
|
/// Return the locale name corresponding to this language usable with
|
2009-02-07 10:09:48 -05:00
|
|
|
/// @c setlocale() on the current system.
|
2008-10-17 16:27:36 -04:00
|
|
|
wxString GetLocaleName() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-03-19 11:08:49 -04:00
|
|
|
/**
|
2009-03-29 13:15:43 -04:00
|
|
|
The category of locale settings.
|
|
|
|
|
|
|
|
@see wxLocale::GetInfo()
|
2009-03-19 11:08:49 -04:00
|
|
|
*/
|
|
|
|
enum wxLocaleCategory
|
|
|
|
{
|
2009-03-29 13:15:43 -04:00
|
|
|
/// Number formatting.
|
2009-03-19 11:08:49 -04:00
|
|
|
wxLOCALE_CAT_NUMBER,
|
|
|
|
|
2009-03-29 13:15:43 -04:00
|
|
|
/// Date/time formatting.
|
2009-03-19 11:08:49 -04:00
|
|
|
wxLOCALE_CAT_DATE,
|
|
|
|
|
2009-03-29 13:15:43 -04:00
|
|
|
/// Monetary values formatting.
|
2009-03-19 11:08:49 -04:00
|
|
|
wxLOCALE_CAT_MONEY,
|
|
|
|
|
2009-03-29 13:15:43 -04:00
|
|
|
/**
|
|
|
|
Default category for the wxLocaleInfo value.
|
|
|
|
|
|
|
|
This category can be used for values which only make sense for a single
|
|
|
|
category, e.g. wxLOCALE_SHORT_DATE_FMT which can only be used with
|
|
|
|
wxLOCALE_CAT_DATE. As this is the default value of the second parameter
|
|
|
|
of wxLocale::GetInfo(), wxLOCALE_CAT_DATE can be omitted when asking
|
|
|
|
for wxLOCALE_SHORT_DATE_FMT value.
|
|
|
|
|
|
|
|
@since 2.9.0
|
|
|
|
*/
|
|
|
|
wxLOCALE_CAT_DEFAULT
|
2009-03-19 11:08:49 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
The values understood by wxLocale::GetInfo().
|
2009-04-19 09:29:19 -04:00
|
|
|
|
|
|
|
Note that for the @c wxLOCALE_*_FMT constants (the date and time formats),
|
|
|
|
the strings returned by wxLocale::GetInfo() use strftime() or,
|
|
|
|
equivalently, wxDateTime::Format() format. If the relevant format
|
|
|
|
couldn't be determined, an empty string is returned -- there is no
|
|
|
|
fallback value so that the application could determine the best course
|
|
|
|
of actions itself in such case.
|
|
|
|
|
|
|
|
All of these values are used with @c wxLOCALE_CAT_DATE in wxLocale::GetInfo() or,
|
|
|
|
more typically, with @c wxLOCALE_CAT_DEFAULT as they only apply to a single category.
|
2009-03-19 11:08:49 -04:00
|
|
|
*/
|
|
|
|
enum wxLocaleInfo
|
|
|
|
{
|
2009-03-29 13:15:43 -04:00
|
|
|
/**
|
|
|
|
The thousands separator.
|
|
|
|
|
|
|
|
This value can be used with either wxLOCALE_CAT_NUMBER or
|
|
|
|
wxLOCALE_CAT_MONEY categories.
|
|
|
|
*/
|
2009-03-19 11:08:49 -04:00
|
|
|
wxLOCALE_THOUSANDS_SEP,
|
|
|
|
|
2009-03-29 13:15:43 -04:00
|
|
|
/**
|
|
|
|
The character used as decimal point.
|
|
|
|
|
|
|
|
This value can be used with either wxLOCALE_CAT_NUMBER or
|
|
|
|
wxLOCALE_CAT_MONEY categories.
|
|
|
|
*/
|
|
|
|
wxLOCALE_DECIMAL_POINT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
Short date format.
|
|
|
|
|
|
|
|
Notice that short and long date formats may be the same under POSIX
|
2009-04-19 09:29:19 -04:00
|
|
|
systems currently but may, and typically are, different under MSW or OS X.
|
2009-03-29 13:15:43 -04:00
|
|
|
|
|
|
|
@since 2.9.0
|
|
|
|
*/
|
|
|
|
wxLOCALE_SHORT_DATE_FMT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
Long date format.
|
|
|
|
|
|
|
|
@since 2.9.0
|
|
|
|
*/
|
|
|
|
wxLOCALE_LONG_DATE_FMT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
Date and time format.
|
|
|
|
|
|
|
|
@since 2.9.0
|
|
|
|
*/
|
|
|
|
wxLOCALE_DATE_TIME_FMT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
Time format.
|
|
|
|
|
|
|
|
@since 2.9.0
|
|
|
|
*/
|
|
|
|
wxLOCALE_TIME_FMT
|
2009-03-19 11:08:49 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxLocale
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxLocale class encapsulates all language-dependent settings and is a
|
|
|
|
generalization of the C locale concept.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2010-04-24 03:06:18 -04:00
|
|
|
In wxWidgets this class manages current locale. It also initializes and
|
|
|
|
activates wxTranslations object that manages message catalogs.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-17 16:27:36 -04:00
|
|
|
For a list of the supported languages, please see ::wxLanguage enum values.
|
|
|
|
These constants may be used to specify the language in wxLocale::Init and
|
|
|
|
are returned by wxLocale::GetSystemLanguage.
|
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl you can't use the '_' function name, so
|
2008-03-08 09:43:31 -05:00
|
|
|
the @c Wx::Locale module can export the @c gettext and
|
|
|
|
@c gettext_noop under any given name.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
2008-10-17 16:27:36 -04:00
|
|
|
# this imports gettext ( equivalent to Wx::GetTranslation
|
2008-03-08 08:52:38 -05:00
|
|
|
# and gettext_noop ( a noop )
|
|
|
|
# into your module
|
|
|
|
use Wx::Locale qw(:default);
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
# ....
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
# use the functions
|
2008-04-01 09:59:28 -04:00
|
|
|
print gettext( "Panic!" );
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-01 09:59:28 -04:00
|
|
|
button = Wx::Button-new( window, -1, gettext( "Label" ) );
|
2008-03-08 08:52:38 -05:00
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
|
|
|
use Wx::Locale 'gettext' = 't',
|
|
|
|
'gettext_noop' = 'gettext_noop';
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
# ...
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
# use the functions
|
2008-04-01 09:59:28 -04:00
|
|
|
print t( "Panic!!" );
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
# ...
|
|
|
|
@endcode
|
2008-10-17 16:27:36 -04:00
|
|
|
@endWxPerlOnly
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
2009-02-20 06:34:52 -05:00
|
|
|
@category{cfg}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2010-04-24 03:06:18 -04:00
|
|
|
@see @ref overview_i18n, @ref page_samples_internat, wxXLocale, wxTranslations
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxLocale
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-10-17 16:27:36 -04:00
|
|
|
/**
|
|
|
|
This is the default constructor and it does nothing to initialize the object:
|
|
|
|
Init() must be used to do that.
|
|
|
|
*/
|
|
|
|
wxLocale();
|
|
|
|
|
|
|
|
/**
|
|
|
|
See Init() for parameters description.
|
|
|
|
*/
|
2010-04-16 07:29:22 -04:00
|
|
|
wxLocale(int language, int flags = wxLOCALE_LOAD_DEFAULT);
|
2008-10-17 16:27:36 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
See Init() for parameters description.
|
2008-10-17 16:27:36 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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().
|
|
|
|
Second, this wxLocale object becomes the new current global locale for the
|
2008-10-17 16:27:36 -04:00
|
|
|
application and so all subsequent calls to ::wxGetTranslation() will try to
|
2008-03-08 08:52:38 -05:00
|
|
|
translate the messages using the message catalogs for this locale.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxLocale(const wxString& name,
|
2010-11-23 17:14:18 -05:00
|
|
|
const wxString& shortName = wxEmptyString,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxString& locale = wxEmptyString,
|
2010-04-16 07:29:22 -04:00
|
|
|
bool bLoadDefault = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
The destructor, like the constructor, also has global side effects: the
|
2008-10-17 16:27:36 -04:00
|
|
|
previously set locale is restored and so the changes described in
|
2008-03-08 08:52:38 -05:00
|
|
|
Init() documentation are rolled back.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxLocale();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-04-24 03:06:18 -04:00
|
|
|
Calls wxTranslations::AddCatalog(const wxString&).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool AddCatalog(const wxString& domain);
|
2008-12-12 10:40:54 -05:00
|
|
|
|
|
|
|
/**
|
2010-04-24 03:06:18 -04:00
|
|
|
Calls wxTranslations::AddCatalog(const wxString&, wxLanguage).
|
|
|
|
*/
|
|
|
|
bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage);
|
2008-12-12 10:40:54 -05:00
|
|
|
|
2010-04-24 03:06:18 -04:00
|
|
|
/**
|
|
|
|
Calls wxTranslations::AddCatalog(const wxString&, wxLanguage, const wxString&).
|
2008-12-12 10:40:54 -05:00
|
|
|
*/
|
2008-10-17 16:27:36 -04:00
|
|
|
bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxString& msgIdCharset);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-04-24 03:06:18 -04:00
|
|
|
Calls wxFileTranslationsLoader::AddCatalogLookupPathPrefix().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
static void AddCatalogLookupPathPrefix(const wxString& prefix);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-17 16:27:36 -04:00
|
|
|
Adds custom, user-defined language to the database of known languages.
|
|
|
|
This database is used in conjunction with the first form of Init().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static void AddLanguage(const wxLanguageInfo& info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
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").
|
2008-10-17 16:27:36 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Returns the information for the given language or @NULL if this language
|
2008-10-17 16:27:36 -04:00
|
|
|
is unknown. Note that even if the returned pointer is valid, the caller
|
|
|
|
should @e not delete it.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetLanguageInfo()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
static const wxLanguageInfo* FindLanguageInfo(const wxString& locale);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
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().
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetCanonicalName() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-04-24 03:06:18 -04:00
|
|
|
Calls wxTranslations::GetHeaderValue().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString GetHeaderValue(const wxString& header,
|
2008-03-09 12:24:26 -04:00
|
|
|
const wxString& domain = wxEmptyString) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-12-14 11:11:22 -05:00
|
|
|
Returns the ::wxLanguage constant of current language.
|
2008-10-17 16:27:36 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Note that you can call this function only if you used the form of
|
2008-12-14 11:11:22 -05:00
|
|
|
Init() that takes ::wxLanguage argument.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetLanguage() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-17 16:27:36 -04:00
|
|
|
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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:10:54 -05:00
|
|
|
static const wxLanguageInfo* GetLanguageInfo(int lang);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns English name of the given language or empty string if this
|
|
|
|
language is unknown.
|
2008-10-17 16:27:36 -04:00
|
|
|
|
|
|
|
See GetLanguageInfo() for a remark about special meaning of @c wxLANGUAGE_DEFAULT.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:10:54 -05:00
|
|
|
static wxString GetLanguageName(int lang);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2010-04-24 03:06:18 -04:00
|
|
|
/**
|
|
|
|
Returns canonical name (see GetCanonicalName()) of the given language
|
|
|
|
or empty string if this language is unknown.
|
|
|
|
|
|
|
|
See GetLanguageInfo() for a remark about special meaning of @c wxLANGUAGE_DEFAULT.
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
static wxString GetLanguageCanonicalName(int lang);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-10-17 16:27:36 -04:00
|
|
|
Returns the locale name as passed to the constructor or Init().
|
|
|
|
|
|
|
|
This is a full, human-readable name, e.g. "English" or "French".
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-17 16:27:36 -04:00
|
|
|
const wxString& GetLocale() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current short name for the locale (as given to the constructor or
|
|
|
|
the Init() function).
|
|
|
|
*/
|
2008-10-17 16:27:36 -04:00
|
|
|
const wxString& GetName() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-04-24 03:06:18 -04:00
|
|
|
Calls wxTranslations::GetString(const wxString&, const wxString&) const.
|
2008-10-17 16:27:36 -04:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual const wxString& GetString(const wxString& origString,
|
|
|
|
const wxString& domain = wxEmptyString) const;
|
2008-10-17 16:27:36 -04:00
|
|
|
|
|
|
|
/**
|
2010-05-05 08:27:07 -04:00
|
|
|
Calls wxTranslations::GetString(const wxString&, const wxString&, unsigned, const wxString&) const.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 13:12:27 -04:00
|
|
|
virtual const wxString& GetString(const wxString& origString,
|
2010-05-05 08:27:07 -04:00
|
|
|
const wxString& origString2, unsigned n,
|
2008-10-27 13:12:27 -04:00
|
|
|
const wxString& domain = wxEmptyString) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns current platform-specific locale name as passed to setlocale().
|
|
|
|
Compare GetCanonicalName().
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetSysName() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Tries to detect the user's default font encoding.
|
2008-10-17 16:27:36 -04:00
|
|
|
Returns wxFontEncoding() value or @c wxFONTENCODING_SYSTEM if it
|
|
|
|
couldn't be determined.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:10:54 -05:00
|
|
|
static wxFontEncoding GetSystemEncoding();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-17 16:27:36 -04:00
|
|
|
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 GetSystemEncoding() instead.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Returns a user-readable string value or an empty string if it couldn't be
|
|
|
|
determined.
|
|
|
|
*/
|
2009-01-10 17:10:54 -05:00
|
|
|
static wxString GetSystemEncodingName();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2012-09-08 04:58:38 -04:00
|
|
|
Tries to detect the user's default locale setting.
|
2009-03-29 13:15:43 -04:00
|
|
|
|
2009-03-19 11:08:49 -04:00
|
|
|
Returns the ::wxLanguage value or @c wxLANGUAGE_UNKNOWN if the language-guessing
|
2008-10-17 16:27:36 -04:00
|
|
|
algorithm failed.
|
2012-09-08 04:58:38 -04:00
|
|
|
|
|
|
|
@note This function works with @em locales and returns the user's default
|
|
|
|
locale. This may be, and usually is, the same as their preferred UI
|
|
|
|
language, but it's not the same thing. Use wxTranslation to obtain
|
|
|
|
@em language information.
|
|
|
|
|
|
|
|
@see wxTranslations::GetBestTranslation().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:10:54 -05:00
|
|
|
static int GetSystemLanguage();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-03-19 11:08:49 -04:00
|
|
|
/**
|
|
|
|
Get the values of the given locale-dependent datum.
|
|
|
|
|
2009-03-29 13:15:43 -04:00
|
|
|
This function returns the value of the locale-specific option specified
|
|
|
|
by the given @a index.
|
|
|
|
|
|
|
|
@param index
|
|
|
|
One of the elements of wxLocaleInfo enum.
|
|
|
|
@param cat
|
|
|
|
The category to use with the given index or wxLOCALE_CAT_DEFAULT if
|
|
|
|
the index can only apply to a single category.
|
|
|
|
@return
|
|
|
|
The option value or empty string if the function failed.
|
2009-03-19 11:08:49 -04:00
|
|
|
*/
|
2009-03-29 13:15:43 -04:00
|
|
|
static wxString GetInfo(wxLocaleInfo index,
|
|
|
|
wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT);
|
2009-03-19 11:08:49 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-10-17 16:27:36 -04:00
|
|
|
Initializes the wxLocale instance.
|
|
|
|
|
|
|
|
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().
|
|
|
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param language
|
2008-12-14 11:11:22 -05:00
|
|
|
::wxLanguage identifier of the locale.
|
2008-10-17 16:27:36 -04:00
|
|
|
@c wxLANGUAGE_DEFAULT has special meaning -- wxLocale will use system's
|
|
|
|
default language (see GetSystemLanguage()).
|
2008-03-08 09:43:31 -05:00
|
|
|
@param flags
|
2008-03-09 08:33:59 -04:00
|
|
|
Combination of the following:
|
2008-10-17 16:27:36 -04:00
|
|
|
- wxLOCALE_LOAD_DEFAULT: Load the message catalog for the given locale
|
|
|
|
containing the translations of standard wxWidgets messages
|
|
|
|
automatically.
|
2010-04-16 07:29:09 -04:00
|
|
|
- wxLOCALE_DONT_LOAD_DEFAULT: Negation of wxLOCALE_LOAD_DEFAULT.
|
2008-10-17 16:55:12 -04:00
|
|
|
|
|
|
|
@return @true on success or @false if the given locale couldn't be set.
|
|
|
|
*/
|
|
|
|
bool Init(int language = wxLANGUAGE_DEFAULT,
|
2010-04-16 07:29:22 -04:00
|
|
|
int flags = wxLOCALE_LOAD_DEFAULT);
|
2008-10-17 16:55:12 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
@deprecated
|
|
|
|
This form is deprecated, use the other one unless you know what you are doing.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@param name
|
|
|
|
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.
|
|
|
|
@param locale
|
2008-10-17 16:27:36 -04:00
|
|
|
The parameter for the call to setlocale().
|
|
|
|
Note that it is platform-specific.
|
2008-03-09 08:33:59 -04:00
|
|
|
@param bLoadDefault
|
2008-10-17 16:27:36 -04:00
|
|
|
May be set to @false to prevent loading of the message catalog for the
|
|
|
|
given locale containing the translations of standard wxWidgets messages.
|
2008-03-09 08:33:59 -04:00
|
|
|
This parameter would be rarely used in normal circumstances.
|
2008-10-17 16:27:36 -04:00
|
|
|
*/
|
2010-11-23 17:14:18 -05:00
|
|
|
bool Init(const wxString& name, const wxString& shortName = wxEmptyString,
|
2010-04-16 07:29:22 -04:00
|
|
|
const wxString& locale = wxEmptyString, bool bLoadDefault = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Check whether the operating system and/or C run time environment supports
|
|
|
|
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.
|
2008-12-14 11:11:22 -05:00
|
|
|
|
|
|
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-21 06:34:23 -04:00
|
|
|
@since 2.7.1.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static bool IsAvailable(int lang);
|
|
|
|
|
2010-04-24 03:06:18 -04:00
|
|
|
/**
|
|
|
|
Calls wxTranslations::IsLoaded().
|
|
|
|
*/
|
|
|
|
bool IsLoaded(const wxString& domain) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the locale could be set successfully.
|
|
|
|
*/
|
|
|
|
bool IsOk() const;
|
|
|
|
};
|