Inflection
Morphology Inflection
Loading...
Searching...
No Matches
LocaleUtils.hpp
1/*
2 * Copyright 2016-2024 Apple Inc. All rights reserved.
3 */
4#pragma once
5
6#include <inflection/util/fwd.hpp>
7#include <map>
8#include <set>
9#include <string>
10#include <string_view>
11#include <vector>
12
21class INFLECTION_CLASS_API inflection::util::LocaleUtils final
22{
23public:
32 static ::inflection::util::ULocale toLocale(const ::std::u16string& localeString);
41 static ::std::vector<::inflection::util::ULocale> toLocales(const ::std::u16string & localesString);
57 static ::std::u16string toString(const ::inflection::util::ULocale& locale, const ::std::u16string& separator);
71 static ::std::u16string toString(const ::inflection::util::ULocale& locale);
76 static ::std::set<::inflection::util::ULocale, std::less<>> getSupportedLocaleList();
83 static ::std::map<::std::string, ::std::vector<::inflection::util::ULocale>, std::less<>> getSupportedLocaleMap();
84
96 static ::inflection::util::ULocale createValidRegionAwareLanguage(const ::inflection::util::ULocale& language, const ::inflection::util::ULocale& region);
104 static ::std::pair<::inflection::util::ULocale, ::inflection::util::ULocale> getFallbackPair(const ::inflection::util::ULocale& locale);
112 static bool areLanguageScriptCompatible(const ::inflection::util::ULocale& locale1, const ::inflection::util::ULocale& locale2);
113
114private:
115 LocaleUtils() = delete;
116
117public:
121 static const ::inflection::util::ULocale& ARABIC();
125 static const ::inflection::util::ULocale& SAUDI_ARABIA();
129 static const ::inflection::util::ULocale& BULGARIAN();
133 static const ::inflection::util::ULocale& BULGARIA();
137 static const ::inflection::util::ULocale& CATALAN();
141 static const ::inflection::util::ULocale& SPAIN_CATALAN();
145 static const ::inflection::util::ULocale& CZECH();
149 static const ::inflection::util::ULocale& CZECHIA();
153 static const ::inflection::util::ULocale& DANISH();
157 static const ::inflection::util::ULocale& DENMARK();
161 static const ::inflection::util::ULocale& GERMAN();
165 static const ::inflection::util::ULocale& GERMANY();
169 static const ::inflection::util::ULocale& SWITZERLAND_GERMAN();
173 static const ::inflection::util::ULocale& AUSTRIA();
177 static const ::inflection::util::ULocale& GREEK();
181 static const ::inflection::util::ULocale& GREECE();
185 static const ::inflection::util::ULocale& ENGLISH();
189 static const ::inflection::util::ULocale& US();
193 static const ::inflection::util::ULocale& AUSTRALIA_ENGLISH();
197 static const ::inflection::util::ULocale& CANADIAN_ENGLISH();
201 static const ::inflection::util::ULocale& SINGAPOREAN_ENGLISH();
206 static const ::inflection::util::ULocale& GREAT_BRITAIN();
210 static const ::inflection::util::ULocale& NEW_ZEALAND_ENGLISH();
214 static const ::inflection::util::ULocale& INDIAN_ENGLISH();
218 static const ::inflection::util::ULocale& SOUTH_AFRICAN_ENGLISH();
222 static const ::inflection::util::ULocale& IRISH_ENGLISH();
226 static const ::inflection::util::ULocale& SPANISH();
230 static const ::inflection::util::ULocale& SPAIN_SPANISH();
234 static const ::inflection::util::ULocale& MEXICO_SPANISH();
238 static const ::inflection::util::ULocale& US_SPANISH();
242 static const ::inflection::util::ULocale& CHILEAN_SPANISH();
246 static const ::inflection::util::ULocale& ESTONIAN();
250 static const ::inflection::util::ULocale& ESTONIA();
254 static const ::inflection::util::ULocale& FINNISH();
258 static const ::inflection::util::ULocale& FINLAND();
262 static const ::inflection::util::ULocale& FRENCH();
266 static const ::inflection::util::ULocale& FRANCE();
270 static const ::inflection::util::ULocale& BELGIUM_FRENCH();
274 static const ::inflection::util::ULocale& SWITZERLAND_FRENCH();
278 static const ::inflection::util::ULocale& CANADIAN_FRENCH();
282 static const ::inflection::util::ULocale& HEBREW();
286 static const ::inflection::util::ULocale& ISRAEL();
290 static const ::inflection::util::ULocale& HINDI();
294 static const ::inflection::util::ULocale& INDIA_HINDI();
298 static const ::inflection::util::ULocale& CROATIAN();
302 static const ::inflection::util::ULocale& CROATIA();
306 static const ::inflection::util::ULocale& HUNGARIAN();
310 static const ::inflection::util::ULocale& HUNGARY();
314 static const ::inflection::util::ULocale& INDONESIAN();
318 static const ::inflection::util::ULocale& INDONESIA();
322 static const ::inflection::util::ULocale& ICELANDIC();
326 static const ::inflection::util::ULocale& ICELAND();
330 static const ::inflection::util::ULocale& ITALIAN();
334 static const ::inflection::util::ULocale& ITALY();
338 static const ::inflection::util::ULocale& SWITZERLAND_ITALIAN();
342 static const ::inflection::util::ULocale& JAPANESE();
346 static const ::inflection::util::ULocale& JAPAN();
350 static const ::inflection::util::ULocale& KAZAKH();
354 static const ::inflection::util::ULocale& KAZAKHSTAN();
358 static const ::inflection::util::ULocale& KOREAN();
362 static const ::inflection::util::ULocale& KOREA();
366 static const ::inflection::util::ULocale& LITHUANIAN();
370 static const ::inflection::util::ULocale& LITHUANIA();
374 static const ::inflection::util::ULocale& MALAY();
378 static const ::inflection::util::ULocale& MALAYSIA();
382 static const ::inflection::util::ULocale& MALAYALAM();
386 static const ::inflection::util::ULocale& INDIA_MALAYALAM();
390 static const ::inflection::util::ULocale& NORWEGIAN();
394 static const ::inflection::util::ULocale& NORWAY();
398 static const ::inflection::util::ULocale& DUTCH();
402 static const ::inflection::util::ULocale& NETHERLANDS();
406 static const ::inflection::util::ULocale& BELGIUM_DUTCH();
410 static const ::inflection::util::ULocale& POLISH();
414 static const ::inflection::util::ULocale& POLAND();
418 static const ::inflection::util::ULocale& PORTUGUESE();
422 static const ::inflection::util::ULocale& PORTUGAL();
426 static const ::inflection::util::ULocale& BRAZIL();
430 static const ::inflection::util::ULocale& ROMANIAN();
434 static const ::inflection::util::ULocale& ROMANIA();
438 static const ::inflection::util::ULocale& RUSSIAN();
442 static const ::inflection::util::ULocale& RUSSIA();
446 static const ::inflection::util::ULocale& SLOVAK();
450 static const ::inflection::util::ULocale& SLOVAKIA();
454 static const ::inflection::util::ULocale& SERBIAN();
458 static const ::inflection::util::ULocale& SERBIA();
462 static const ::inflection::util::ULocale& SWEDISH();
466 static const ::inflection::util::ULocale& SWEDEN();
470 static const ::inflection::util::ULocale& THAI();
474 static const ::inflection::util::ULocale& THAILAND();
478 static const ::inflection::util::ULocale& TURKISH();
482 static const ::inflection::util::ULocale& TURKEY();
486 static const ::inflection::util::ULocale& UKRAINIAN();
490 static const ::inflection::util::ULocale& UKRAINE();
494 static const ::inflection::util::ULocale& VIETNAMESE();
498 static const ::inflection::util::ULocale& VIETNAM();
502 static const ::inflection::util::ULocale& SHANGHAINESE();
506 static const ::inflection::util::ULocale& CHINA_SHANGHAINESE();
510 static const ::inflection::util::ULocale& CANTONESE();
515 static const ::inflection::util::ULocale& CHINA_CANTONESE();
520 static const ::inflection::util::ULocale& HONGKONG_CANTONESE();
525 static const ::inflection::util::ULocale& CHINESE();
530 static const ::inflection::util::ULocale& SIMPLIFIED_CHINESE();
535 static const ::inflection::util::ULocale& TRADITIONAL_CHINESE();
540 static const ::inflection::util::ULocale& HONGKONG_CHINESE();
545 static const ::inflection::util::ULocale& CHINA();
550 static const ::inflection::util::ULocale& TAIWAN();
555 static const ::inflection::util::ULocale& ROOT();
556
557private:
558 static const ::std::map<::std::string, ::std::vector<::inflection::util::ULocale>, std::less<>>& BASE_SUPPORTED_LOCALES();
559};
Provides utility functions for use with ULocale objects.
static const ::inflection::util::ULocale & MALAYSIA()
static const ::inflection::util::ULocale & CHINA_SHANGHAINESE()
::std::u16string toString(const ::inflection::util::ULocale &locale)
static const ::inflection::util::ULocale & AUSTRALIA_ENGLISH()
static const ::inflection::util::ULocale & SWITZERLAND_FRENCH()
static const ::inflection::util::ULocale & GERMAN()
static const ::inflection::util::ULocale & US_SPANISH()
static const ::inflection::util::ULocale & TURKISH()
static const ::inflection::util::ULocale & NORWAY()
static const ::inflection::util::ULocale & NEW_ZEALAND_ENGLISH()
static const ::inflection::util::ULocale & INDONESIAN()
::std::u16string toString(const ::inflection::util::ULocale &locale, const ::std::u16string &separator)
static const ::inflection::util::ULocale & CANTONESE()
static const ::inflection::util::ULocale & BULGARIAN()
static const ::inflection::util::ULocale & INDIA_MALAYALAM()
static const ::inflection::util::ULocale & SAUDI_ARABIA()
static const ::inflection::util::ULocale & PORTUGUESE()
static const ::inflection::util::ULocale & GERMANY()
::inflection::util::ULocale createValidRegionAwareLanguage(const ::inflection::util::ULocale &language, const ::inflection::util::ULocale &region)
static const ::inflection::util::ULocale & GREEK()
static const ::inflection::util::ULocale & SWITZERLAND_GERMAN()
static const ::inflection::util::ULocale & SWEDEN()
static const ::inflection::util::ULocale & NORWEGIAN()
static const ::inflection::util::ULocale & IRISH_ENGLISH()
static const ::inflection::util::ULocale & SINGAPOREAN_ENGLISH()
static const ::inflection::util::ULocale & KOREAN()
static const ::inflection::util::ULocale & LITHUANIA()
static const ::inflection::util::ULocale & HONGKONG_CANTONESE()
static const ::inflection::util::ULocale & CZECH()
static const ::inflection::util::ULocale & HEBREW()
static const ::inflection::util::ULocale & JAPANESE()
static const ::inflection::util::ULocale & KAZAKH()
static const ::inflection::util::ULocale & INDIAN_ENGLISH()
static const ::inflection::util::ULocale & GREECE()
static const ::inflection::util::ULocale & AUSTRIA()
static const ::inflection::util::ULocale & HUNGARY()
static const ::inflection::util::ULocale & SLOVAK()
static const ::inflection::util::ULocale & ESTONIAN()
static const ::inflection::util::ULocale & FRANCE()
static const ::inflection::util::ULocale & LITHUANIAN()
static const ::inflection::util::ULocale & SPANISH()
static const ::inflection::util::ULocale & HINDI()
static const ::inflection::util::ULocale & THAILAND()
static const ::inflection::util::ULocale & ROOT()
static const ::inflection::util::ULocale & CHILEAN_SPANISH()
static const ::inflection::util::ULocale & CHINA_CANTONESE()
static const ::inflection::util::ULocale & SHANGHAINESE()
static const ::inflection::util::ULocale & PORTUGAL()
static const ::inflection::util::ULocale & VIETNAMESE()
static const ::inflection::util::ULocale & RUSSIAN()
static const ::inflection::util::ULocale & RUSSIA()
static const ::inflection::util::ULocale & BELGIUM_FRENCH()
static const ::inflection::util::ULocale & ROMANIAN()
static const ::inflection::util::ULocale & US()
static ::std::set<::inflection::util::ULocale, std::less<> > getSupportedLocaleList()
static const ::inflection::util::ULocale & KAZAKHSTAN()
static const ::inflection::util::ULocale & THAI()
static const ::inflection::util::ULocale & NETHERLANDS()
static const ::inflection::util::ULocale & SPAIN_CATALAN()
static const ::inflection::util::ULocale & INDIA_HINDI()
static const ::inflection::util::ULocale & JAPAN()
static const ::inflection::util::ULocale & CHINA()
static ::std::map<::std::string, ::std::vector<::inflection::util::ULocale >, std::less<> > getSupportedLocaleMap()
static const ::inflection::util::ULocale & DANISH()
static const ::inflection::util::ULocale & SERBIA()
static const ::inflection::util::ULocale & KOREA()
static const ::inflection::util::ULocale & SWITZERLAND_ITALIAN()
static const ::inflection::util::ULocale & UKRAINE()
static const ::inflection::util::ULocale & BULGARIA()
static const ::inflection::util::ULocale & SPAIN_SPANISH()
static const ::inflection::util::ULocale & BRAZIL()
static const ::inflection::util::ULocale & BELGIUM_DUTCH()
static const ::inflection::util::ULocale & GREAT_BRITAIN()
static ::std::vector<::inflection::util::ULocale > toLocales(const ::std::u16string &localesString)
static const ::inflection::util::ULocale & ITALY()
static const ::inflection::util::ULocale & ITALIAN()
static bool areLanguageScriptCompatible(const ::inflection::util::ULocale &locale1, const ::inflection::util::ULocale &locale2)
static const ::inflection::util::ULocale & INDONESIA()
static const ::inflection::util::ULocale & MEXICO_SPANISH()
static const ::inflection::util::ULocale & POLISH()
static const ::inflection::util::ULocale & CHINESE()
static const ::inflection::util::ULocale & ARABIC()
static const ::inflection::util::ULocale & HUNGARIAN()
static const ::inflection::util::ULocale & CATALAN()
static const ::inflection::util::ULocale & MALAYALAM()
static const ::inflection::util::ULocale & FINLAND()
static const ::inflection::util::ULocale & ESTONIA()
static const ::inflection::util::ULocale & ENGLISH()
static const ::inflection::util::ULocale & FINNISH()
static const ::inflection::util::ULocale & SIMPLIFIED_CHINESE()
static const ::inflection::util::ULocale & CZECHIA()
static const ::inflection::util::ULocale & TAIWAN()
static const ::inflection::util::ULocale & TURKEY()
static const ::inflection::util::ULocale & ROMANIA()
static const ::inflection::util::ULocale & UKRAINIAN()
static const ::inflection::util::ULocale & SLOVAKIA()
static const ::inflection::util::ULocale & HONGKONG_CHINESE()
static const ::inflection::util::ULocale & SWEDISH()
static const ::inflection::util::ULocale & CANADIAN_ENGLISH()
static const ::inflection::util::ULocale & CROATIA()
::inflection::util::ULocale toLocale(const ::std::u16string &localeString)
static const ::inflection::util::ULocale & SOUTH_AFRICAN_ENGLISH()
static const ::inflection::util::ULocale & CANADIAN_FRENCH()
static const ::inflection::util::ULocale & POLAND()
static ::std::pair<::inflection::util::ULocale, ::inflection::util::ULocale > getFallbackPair(const ::inflection::util::ULocale &locale)
static const ::inflection::util::ULocale & MALAY()
static const ::inflection::util::ULocale & ICELAND()
static const ::inflection::util::ULocale & ISRAEL()
static const ::inflection::util::ULocale & FRENCH()
static const ::inflection::util::ULocale & SERBIAN()
static const ::inflection::util::ULocale & DUTCH()
static const ::inflection::util::ULocale & CROATIAN()
static const ::inflection::util::ULocale & TRADITIONAL_CHINESE()
static const ::inflection::util::ULocale & VIETNAM()
static const ::inflection::util::ULocale & DENMARK()
static const ::inflection::util::ULocale & ICELANDIC()
The C++ namespace for Inflection.
Definition fwd.hpp:11