Inflection
Morphology Inflection
|
Provides utility functions for use with ULocale objects. More...
#include <LocaleUtils.hpp>
Public Member Functions | |
static ::std::vector<::inflection::util::ULocale > | toLocales (const ::std::u16string &localesString) |
static ::std::set<::inflection::util::ULocale, std::less<> > | getSupportedLocaleList () |
static ::std::map<::std::string, ::std::vector<::inflection::util::ULocale >, std::less<> > | getSupportedLocaleMap () |
static ::std::pair<::inflection::util::ULocale, ::inflection::util::ULocale > | getFallbackPair (const ::inflection::util::ULocale &locale) |
Provides utility functions for use with ULocale objects.
This class contains many static functions that are very useful for manipulation, combination, accessing, and validation of ULocale objects.
This class also has functions for getting an instance of ULocale for all of Inflection's supported locales, as well as a list of all currently supported locales (getSupportedLocaleList()).
Definition at line 21 of file LocaleUtils.hpp.
|
static |
ar: Arabic
|
static |
Returns True if the two locales have a compatible script (written form) and language (spoken form).
locale1 | The first locale to compare. |
locale2 | The second locale to compare. |
|
static |
en_AU: English (Australia)
|
static |
de_AT: German (Austria)
|
static |
nl_BE: Dutch (Belgium)
|
static |
fr_BE: French (Belgium)
|
static |
pt_BR: Portuguese (Brazil)
|
static |
bg_BG: Bulgarian (Bulgaria)
|
static |
bg: Bulgarian
|
static |
en_CA: English (Canada)
|
static |
fr_CA: French (Canada)
|
static |
yue: Cantonese
|
static |
ca: Catalan
|
static |
es_CL: Spanish (Chile)
|
static |
zh_CN: Chinese (China) This represents the Chinese macro-language in China. By default, it represents Simplified Mandarin in China.
|
static |
yue_CN: Cantonese (China) This represents the Cantonese written in the simplified Han script in China.
|
static |
wuu_CN: Shanghainese (China)
|
static |
zh: Chinese This represents the Chinese macro-language. By default, it represents Simplified Mandarin in China.
|
static |
This allows you to have behavior that is close to the spoken language, without forcing an unsupported language variant from being too strictly the region based language. If your iOS language is en_US, but your spoken language is ar_SA, just return ar_SA because ar_US is not valid in CLDR. If your iOS language is ar_TN, but your spoken language is ar_SA, return ar_TN because it's valid in CLDR and ICU. For example, ar_TN uses 0-9 for the digits, but ar_SA uses ٠-٩ for the digits. If your iOS language is es_MX, but your spoken language is es_CO, return es_MX because it's valid in CLDR and ICU. For example, es_MX uses "." for the decimal point, but es_CO uses "," for the decimal point.
language | The spoken language setting |
region | The region setting from the device, which includes the iOS language |
|
static |
hr_HR: Croatian (Croatia)
|
static |
hr: Croatian
|
static |
cs: Czech
|
static |
cs: Czech (Czechia or Czech Republic)
|
static |
da: Danish
|
static |
da_DK: Danish (Denmark)
|
static |
nl: Dutch
|
static |
en: English
|
static |
et_EE: Estonian (Estonia)
|
static |
et: Estonian
|
static |
fi_FI: Finnish (Finland)
|
static |
fi: Finnish
|
static |
fr_FR: French (France)
|
static |
fr: French
|
static |
de: German
|
static |
de_DE: German (Germany)
static ::std::pair<::inflection::util::ULocale, ::inflection::util::ULocale > inflection::util::LocaleUtils::getFallbackPair | ( | const ::inflection::util::ULocale & | locale | ) |
Attempts to fallback to a region specific locale when the region-specific locale is shifted to a region-less locale. This is currently used to get fallbacks for Chinese dialects.
locale | The region-less locale to find a fallback for. |
static ::std::set<::inflection::util::ULocale, std::less<> > inflection::util::LocaleUtils::getSupportedLocaleList | ( | ) |
Returns the list of supported locales in Inflection as a std::set<ULocale>
.
static ::std::map<::std::string, ::std::vector<::inflection::util::ULocale >, std::less<> > inflection::util::LocaleUtils::getSupportedLocaleMap | ( | ) |
Returns a map of the supported locales in Inflection, mapping the language string in the configuration file to the ULocale object it represents.
|
static |
en_GB: English (United Kingdom) It's worth noting that the United Kingdom includes Great Britain and Northern Ireland.
|
static |
el_GR: Greek (Greece)
|
static |
el: Greek
|
static |
he: Hebrew
|
static |
hi: Hindi
|
static |
yue_HK: Cantonese (Hong Kong) This represents the Cantonese written in the traditional Han script in Hong Kong.
|
static |
zh_HK: Chinese (Hong Kong) This represents the Chinese macro-language written in the traditional Han script in Hong Kong. By default, it represents Traditional Cantonese.
|
static |
hu: Hungarian
|
static |
hu_HU: Hungarian (Hungary)
|
static |
is_IS: Icelandic (Iceland)
|
static |
is: Icelandic
|
static |
hi_IN: Hindi (India)
|
static |
en_IN: English (India)
|
static |
id_ID: Indonesian (Indonesia)
|
static |
id: Indonesian
|
static |
en_IE: English (Ireland)
|
static |
he_IL: Hebrew (Israel)
|
static |
it: Italian
|
static |
it_IT: Italian (Italy)
|
static |
ja_JP: Japanese (Japan)
|
static |
ja: Japanese
|
static |
kk: Kazakh
|
static |
kk_KZ: Kazakh (Kazakhstan)
|
static |
ko_KR: Korean (South Korea)
|
static |
ko: Korean
|
static |
lt_LT: Lithuanian (Lithuania)
|
static |
lt: Lithuanian
|
static |
ms: Malay
|
static |
ms_MY: Malay (Malaysia)
|
static |
es_MX: Spanish (Mexico)
|
static |
nl_NL: Dutch (Netherlands)
|
static |
en_NZ: English (New Zealand)
|
static |
nb_NO: Norwegian Bokmål (Norway)
|
static |
nb: Norwegian Bokmål
|
static |
pl_PL: Polish (Poland)
|
static |
pl: Polish
|
static |
pt_BR: Portuguese (Portugal)
|
static |
pt: Portuguese
|
static |
ro_RO: Romanian (Romania)
|
static |
ro: Romanian
|
static |
The root locale is the locale that all other locales derive their data. It does not represent any particular language or region.
|
static |
ru_RU: Russian (Russia)
|
static |
ru: Russian
|
static |
ar_SA: Arabic (Saudi Arabia)
|
static |
sr_RS: Serbian (Serbia)
|
static |
sr: Serbian
|
static |
wuu: Shanghainese
|
static |
zh_Hans: Chinese written in the simplified Han script. This represents the Chinese macro-language written in the simplified Han script. By default, it represents Simplified Mandarin.
|
static |
en_SG: English (Singapore)
|
static |
sk: Slovak
|
static |
sk_SK: Slovak (Slovakia)
|
static |
en_ZA: English (South Africa)
|
static |
ca_ES: Catalan (Spain)
|
static |
es_ES: Spanish (Spain)
|
static |
es: Spanish
|
static |
sv_SE: Swedish (Sweden)
|
static |
sv: Swedish
|
static |
fr_CH: French (Switzerland)
|
static |
de_CH: German (Switzerland)
|
static |
it_CH: Italian (Switzerland)
|
static |
zh_TW: Chinese (Taiwan) This represents the Chinese macro-language in Taiwan. By default, it represents Traditional Mandarin in Taiwan.
|
static |
th: Thai
|
static |
th_TH: Thai (Thailand)
|
static |
Converts a std::u16string
representing a locale into a ULocale object. This function requires a the input string to be either in the ICU style C locale (e.g. "en_US") or the two-letter or three-letter ISO-639 code (see ULocale::ULocale()).
localeString | The input string to construct a ULocale from. |
static ::std::vector<::inflection::util::ULocale > inflection::util::LocaleUtils::toLocales | ( | const ::std::u16string & | localesString | ) |
Converts an array of std::u16string
representing locales into a std::vector
of ULocale objects. This function requires a the input strings to be either in the ICU style C locale (e.g. "en_US") or the two-letter or three-letter ISO-639 code (see ULocale::ULocale()).
localesString | The input strings to construct an array of ULocales from. |
std::vector
of ULocales representing the input string.
|
static |
Converts a ULocale into a std::u16string
representation with the separator "_". The string is formatted as such:
%1_%2_%3_%4
Where:
%1 = The language
%2 = The script
%3 = The country
%4 = The variant.
locale | The ULocale object to represent as a std::u16string . |
std::u16string
.
|
static |
Converts a ULocale into a std::u16string
representation with a given separator. The string is formatted as such:
%1,%2,%3,%4
Where:
%1 = The language
%2 = The script
%3 = The country
%4 = The variant
, = The field separator.
locale | The ULocale object to represent as a std::u16string . |
separator | The field separator characters to use. |
std::u16string
.
|
static |
zh_Hant: Chinese written in the traditional Han script This represents the Chinese macro-language written in the traditional Han script. By default, it represents Traditional Mandarin.
|
static |
tr_TR: Turkish (Turkey)
|
static |
tr: Turkish
|
static |
uk_UA: Ukrainian (Ukraine)
|
static |
uk: Ukrainian
|
static |
en_US: English (United States)
|
static |
es_US: Spanish (United States)
|
static |
vi_VN: Vietnamese (Vietnam)
|
static |
vi: Vietnamese