Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QLocaleId Struct Reference

#include <qlocale_p.h>

+ Collaboration diagram for QLocaleId:

Public Member Functions

bool operator== (QLocaleId other) const
 
bool operator!= (QLocaleId other) const
 
bool isValid () const
 
bool matchesAll () const
 
bool acceptLanguage (quint16 lang) const
 
bool acceptScriptTerritory (QLocaleId other) const
 
QLocaleId withLikelySubtagsAdded () const
 Fill in blank fields of a locale ID.
 
QLocaleId withLikelySubtagsRemoved () const
 
QByteArray name (char separator='-') const
 

Static Public Member Functions

static Q_AUTOTEST_EXPORT QLocaleId fromName (QStringView name)
 

Public Attributes

ushort language_id = 0
 
ushort script_id = 0
 
ushort territory_id = 0
 

Detailed Description

Definition at line 176 of file qlocale_p.h.

Member Function Documentation

◆ acceptLanguage()

bool QLocaleId::acceptLanguage ( quint16  lang) const
inline

Definition at line 193 of file qlocale_p.h.

References language_id.

Referenced by contradicts(), and findLocaleIndexById().

+ Here is the caller graph for this function:

◆ acceptScriptTerritory()

bool QLocaleId::acceptScriptTerritory ( QLocaleId  other) const
inline

Definition at line 199 of file qlocale_p.h.

References other(), script_id, and territory_id.

Referenced by contradicts(), and findLocaleIndexById().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromName()

QLocaleId QLocaleId::fromName ( QStringView  name)
static

Definition at line 609 of file qlocale.cpp.

References QLocale::AnyLanguage, QLocale::C, QLocalePrivate::codeToLanguage(), QLocalePrivate::codeToScript(), QLocalePrivate::codeToTerritory(), and qt_splitLocaleName().

Referenced by contradicts(), Q_GLOBAL_STATIC(), and QLocale::uiLanguages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValid()

bool QLocaleId::isValid ( ) const
inline

◆ matchesAll()

bool QLocaleId::matchesAll ( ) const
inline

Definition at line 188 of file qlocale_p.h.

References language_id, script_id, and territory_id.

Referenced by withLikelySubtagsAdded().

+ Here is the caller graph for this function:

◆ name()

QByteArray QLocaleId::name ( char  separator = '-') const

Definition at line 404 of file qlocale.cpp.

References QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyTerritory, QLocale::C, AlphaCode::decode(), language_id, languageCodeList, QByteArrayLiteral, script_code_list, script_id, territory_code_list, territory_id, and Qt::Uninitialized.

Referenced by QLocalePrivate::bcp47Name(), and QLocale::uiLanguages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator!=()

bool QLocaleId::operator!= ( QLocaleId  other) const
inline

Definition at line 181 of file qlocale_p.h.

References operator==(), and other().

+ Here is the call graph for this function:

◆ operator==()

bool QLocaleId::operator== ( QLocaleId  other) const
inline

Definition at line 179 of file qlocale_p.h.

References language_id, other(), script_id, and territory_id.

Referenced by operator!=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withLikelySubtagsAdded()

QLocaleId QLocaleId::withLikelySubtagsAdded ( ) const

Fill in blank fields of a locale ID.

An ID in which some fields are zero stands for any locale that agrees with it in its non-zero fields. CLDR's likely-subtag data is meant to help us chose which candidate to prefer. (Note, however, that CLDR does have some cases where it maps an ID to a "best match" for which CLDR does not provide data, even though there are locales for which CLDR does provide data that do match the given ID. It's telling us, unhelpfully but truthfully, what locale would (most likely) be meant by (someone using) the combination requested, even when that locale isn't yet supported.) It may also map an obsolete or generic tag to a modern or more specific replacement, possibly filling in some of the other fields in the process (presently only for countries). Note that some fields of the result may remain blank, but there is no more specific recommendation available.

For the formal specification, see https://www.unicode.org/reports/tr35/#Likely_Subtags

Note
We also search und_script_region and und_region; they're not mentioned in the spec, but the examples clearly presume them and CLDR does provide such likely matches.

Definition at line 296 of file qlocale.cpp.

References language_id, likely_subtags, matchesAll(), Q_ASSERT, script_id, and territory_id.

Referenced by QLocaleData::findLocaleIndex(), QLocale::uiLanguages(), and withLikelySubtagsRemoved().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withLikelySubtagsRemoved()

QLocaleId QLocaleId::withLikelySubtagsRemoved ( ) const

Definition at line 380 of file qlocale.cpp.

References language_id, script_id, territory_id, and withLikelySubtagsAdded().

Referenced by QLocalePrivate::bcp47Name(), and QLocale::uiLanguages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ language_id

◆ script_id

◆ territory_id


The documentation for this struct was generated from the following files: