ICU 76.1 76.1
|
C++ API: Locale matcher: User's desired locales vs. More...
#include "unicode/utypes.h"
#include <optional>
#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 | |
namespace | 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... | |
enum | ULocMatchDirection { ULOCMATCH_DIRECTION_WITH_ONE_WAY , ULOCMATCH_DIRECTION_ONLY_TWO_WAY } |
Builder option for whether to include or ignore one-way (fallback) match data. More... | |
C++ API: Locale matcher: User's desired locales vs.
application's supported locales.
Definition in file localematcher.h.
enum ULocMatchDemotion |
Builder option for whether all desired locales are treated equally or earlier ones are preferred.
Enumerator | |
---|---|
ULOCMATCH_DEMOTION_NONE | All desired locales are treated equally.
|
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: Notes:
|
Definition at line 57 of file localematcher.h.
enum ULocMatchDirection |
Builder option for whether to include or ignore one-way (fallback) match data.
The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. Sometimes it is desirable to ignore those.
For example, consider a web application with the UI in a given language, with a link to another, related web app. The link should include the UI language, and the target server may also use the client’s Accept-Language header data. The target server has its own list of supported languages. One may want to favor UI language consistency, that is, if there is a decent match for the original UI language, we want to use it, but not if it is merely a fallback.
Enumerator | |
---|---|
ULOCMATCH_DIRECTION_WITH_ONE_WAY | Locale matching includes one-way matches such as Breton→French. (default)
|
ULOCMATCH_DIRECTION_ONLY_TWO_WAY | Locale matching limited to two-way matches including e.g. Danish↔Norwegian but ignoring one-way matches.
|
Definition at line 113 of file localematcher.h.
enum ULocMatchFavorSubtag |
Builder option for whether the language subtag or the script subtag is most important.
Enumerator | |
---|---|
ULOCMATCH_FAVOR_LANGUAGE | Language differences are most important, then script differences, then region differences. (This is the default behavior.)
|
ULOCMATCH_FAVOR_SCRIPT | Makes script differences matter relatively more than language differences.
|
Definition at line 31 of file localematcher.h.