1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
///////////////////////////////////////////////////////////////////////////////
// Name: wx/localedefs.h
// Purpose: Definitions of common locale-related constants and structs.
// Author: Vadim Zeitlin
// Created: 2021-07-31 (extracted from wx/intl.h)
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LOCALEDEFS_H_
#define _WX_LOCALEDEFS_H_
// ----------------------------------------------------------------------------
// wxLayoutDirection: used by wxWindow, wxDC etc
// ----------------------------------------------------------------------------
// Note that this one must be available even when wxUSE_INTL == 0 as it's used
// outside of locale code too.
enum wxLayoutDirection
{
wxLayout_Default,
wxLayout_LeftToRight,
wxLayout_RightToLeft
};
#if wxUSE_INTL
#include "wx/string.h"
// ----------------------------------------------------------------------------
// wxLocaleCategory: the category of locale settings
// ----------------------------------------------------------------------------
enum wxLocaleTagType
{
// Default (tag as given or else same as wxLOCALE_TAGTYPE_SYSTEM)
wxLOCALE_TAGTYPE_DEFAULT,
// Default type of the system (platform-dependent)
wxLOCALE_TAGTYPE_SYSTEM,
// BCP47-like type: <language>[-<script>][-<region>][-<modifier>]
wxLOCALE_TAGTYPE_BCP47,
// macOS type: <language>[-<script>][_<region>]
wxLOCALE_TAGTYPE_MACOS,
// POSIX type: <language>_<region>[.<charset>][@{<scriptalias>|<modifier>}]
wxLOCALE_TAGTYPE_POSIX,
// Windows type: <language>[-<script>][-<region>][-<extension>][_<sortorder>]
wxLOCALE_TAGTYPE_WINDOWS
};
// ----------------------------------------------------------------------------
// wxLocaleCategory: the category of locale settings
// ----------------------------------------------------------------------------
enum wxLocaleCategory
{
// (any) numbers
wxLOCALE_CAT_NUMBER,
// date/time
wxLOCALE_CAT_DATE,
// monetary value
wxLOCALE_CAT_MONEY,
// default category for wxLocaleInfo values which only apply to a single
// category (e.g. wxLOCALE_SHORT_DATE_FMT)
wxLOCALE_CAT_DEFAULT,
wxLOCALE_CAT_MAX
};
// ----------------------------------------------------------------------------
// wxLocaleInfo: the items understood by wxLocale::GetInfo()
// ----------------------------------------------------------------------------
enum wxLocaleInfo
{
// the thousands separator (for wxLOCALE_CAT_NUMBER or MONEY)
wxLOCALE_THOUSANDS_SEP,
// the character used as decimal point (for wxLOCALE_CAT_NUMBER or MONEY)
wxLOCALE_DECIMAL_POINT,
// the stftime()-formats used for short/long date and time representations
// (under some platforms short and long date formats are the same)
//
// NB: these elements should appear in this order, code in GetInfo() relies
// on it
wxLOCALE_SHORT_DATE_FMT,
wxLOCALE_LONG_DATE_FMT,
wxLOCALE_DATE_TIME_FMT,
wxLOCALE_TIME_FMT
};
// ----------------------------------------------------------------------------
// wxLocaleName: the items understood by wxLocale::GetLocalizedName()
// ----------------------------------------------------------------------------
enum wxLocaleName
{
wxLOCALE_NAME_LOCALE,
wxLOCALE_NAME_LANGUAGE,
wxLOCALE_NAME_COUNTRY
};
// ----------------------------------------------------------------------------
// wxLocaleForm: the forms of names understood by wxLocale::GetLocalizedName()
// ----------------------------------------------------------------------------
enum wxLocaleForm
{
wxLOCALE_FORM_NATIVE,
wxLOCALE_FORM_ENGLISH
};
// ----------------------------------------------------------------------------
// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
// translation information
// ----------------------------------------------------------------------------
struct WXDLLIMPEXP_BASE wxLanguageInfo
{
int Language; // wxLanguage id
wxString LocaleTag; // Tag of locale in BCP 47-like notation
wxString CanonicalName; // Canonical name, e.g. fr_FR
wxString CanonicalRef; // Canonical reference including region,
// if the name specifies the language only, e.g. fr_FR for fr;
// empty, if region is unknown or already part of the name.
#ifdef __WINDOWS__
wxUint32 WinLang, // Win32 language identifiers
WinSublang;
#endif // __WINDOWS__
wxString Description; // human-readable name of the language in English
wxString DescriptionNative; // human-readable name of the language in native language
wxLayoutDirection LayoutDirection;
#ifdef __WINDOWS__
// return the LCID corresponding to this language
wxUint32 GetLCID() const;
#endif // __WINDOWS__
// return the locale name corresponding to this language usable with
// setlocale() on the current system or empty string if this locale is not
// supported
wxString GetLocaleName() const;
// returns CanonicalRef if set, otherwise CanonicalName
wxString GetCanonicalWithRegion() const;
// Call setlocale() and return non-null value if it works for this language.
//
// This function is mostly for internal use, as changing locale involves
// more than just calling setlocale() on some platforms, use wxLocale to
// do everything that needs to be done instead of calling this method.
const char* TrySetLocale() const;
};
#endif // wxUSE_INTL
#endif // _WX_LOCALEDEFS_H_
|