ICU 65.1 65.1

Data Structures | Namespaces | Enumerations
localematcher.h File Reference

C++ API: Locale matcher: User's desired locales vs. More...

`#include "unicode/utypes.h"`
`#include "unicode/locid.h"`
`#include "unicode/stringpiece.h"`
`#include "unicode/uobject.h"`

Go to the source code of this file.

## Data Structures
class | icu::LocaleMatcher
| Immutable class that picks the best match between a user's desired locales and an application's supported locales. More...
class | icu::LocaleMatcher::Result
| Data for the best-matching pair of a desired and a supported locale. More...
class | icu::LocaleMatcher::Builder
| LocaleMatcher builder. More...

## Namespaces
| icu
| File coll.h.

## Enumerations
enum | ULocMatchFavorSubtag { ULOCMATCH_FAVOR_LANGUAGE, ULOCMATCH_FAVOR_SCRIPT }
| Builder option for whether the language subtag or the script subtag is most important. More...
enum | ULocMatchDemotion { ULOCMATCH_DEMOTION_NONE, ULOCMATCH_DEMOTION_REGION }
| Builder option for whether all desired locales are treated equally or earlier ones are preferred. More...

## Detailed Description

C++ API: Locale matcher: User's desired locales vs.

application's supported locales.

Definition in file localematcher.h.

## Enumeration Type Documentation

## ◆ ULocMatchDemotion

enum ULocMatchDemotion

Builder option for whether all desired locales are treated equally or earlier ones are preferred.

See also
  Builder::setDemotionPerDesiredLocale(Demotion)

Draft:
  This API may be changed in the future versions and was introduced in ICU 65

Enumerator
ULOCMATCH_DEMOTION_NONE | All desired locales are treated equally. Draft: This API may be changed in the future versions and was introduced in ICU 65
ULOCMATCH_DEMOTION_REGION | Earlier desired locales are preferred. From each desired locale to the next, the distance to any supported locale is increased by an additional amount which is at least as large as most region mismatches. A later desired locale has to have a better match with some supported locale due to more than merely having the same region subtag. For example: `Supported={en, sv} desired=[en-GB, sv]` yields `Result(en-GB, en)` because with the demotion of sv its perfect match is no better than the region distance between the earlier desired locale en-GB and en=en-US. Notes: In some cases, language and/or script differences can be as small as the typical region difference. (Example: sr-Latn vs. sr-Cyrl) It is possible for certain region differences to be larger than usual, and larger than the demotion. (As of CLDR 35 there is no such case, but this is possible in future versions of the data.) Draft: This API may be changed in the future versions and was introduced in ICU 65

Definition at line 57 of file localematcher.h.

## ◆ ULocMatchFavorSubtag

enum ULocMatchFavorSubtag

Builder option for whether the language subtag or the script subtag is most important.

See also
  Builder::setFavorSubtag(FavorSubtag)

Draft:
  This API may be changed in the future versions and was introduced in ICU 65

Enumerator
ULOCMATCH_FAVOR_LANGUAGE | Language differences are most important, then script differences, then region differences. (This is the default behavior.) Draft: This API may be changed in the future versions and was introduced in ICU 65
ULOCMATCH_FAVOR_SCRIPT | Makes script differences matter relatively more than language differences. Draft: This API may be changed in the future versions and was introduced in ICU 65

Definition at line 31 of file localematcher.h.