Using ISO language and country codes.
More...
|
QStringList | country2LetterCodes () const |
| Get the sorted list of all ISO 3166 2-letter codes for country names. More...
|
|
QStringList | country3DigitCodes () const |
| Get the sorted list of all ISO 3166 3-digit codes for country names. More...
|
|
QStringList | country3LetterCodes () const |
| Get the sorted list of all ISO 3166 3-letter codes for country names. More...
|
|
QString | countryName (const QString &code, const QString &defaultValue=QString()) const |
| Get a localized country name from a country code. More...
|
|
QStringList | language2LetterCodes () const |
| Get the sorted list of all ISO 639-1 2-letter codes for language names. More...
|
|
QStringList | language3LetterCodes () const |
| Get the sorted list of all ISO 639-2 3-letter codes for language names. More...
|
|
QString | languageName (const QString &code, const QString &defaultValue=QString()) const |
| Get a localized language name from a language code. More...
|
|
|
typedef QMap< QString, QString > | StringMap |
| Mapping a string to another string. More...
|
|
|
| QtlIsoLanguages () |
| Private constructor. More...
|
|
void | addCountry (const QString &code2, const QString &code3, const QString &digit3, const QString &name) |
| Add an ISO 3166-1 country code. More...
|
|
void | addLanguage (const QString &code3, const QString &code3alt, const QString &code2, const QString &name) |
| Add an ISO 639 language code. More...
|
|
QStringList | codeList (const StringMap &map) const |
| Get the sorted list of all codes for a given map. More...
|
|
Using ISO language and country codes.
The following standards are covered:
- ISO 639-1: 2-letter codes for language names.
- ISO 639-2: 3-letter codes for language names.
- ISO 3166-1: 2 letter, 3-letter and 3-digit codes for country names.
- See also
- http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
-
http://www.davros.org/misc/iso3166.txt
◆ StringMap
Mapping a string to another string.
◆ QtlIsoLanguages()
QtlIsoLanguages::QtlIsoLanguages |
( |
| ) |
|
|
private |
◆ instance()
◆ languageName()
QString QtlIsoLanguages::languageName |
( |
const QString & |
code, |
|
|
const QString & |
defaultValue = QString() |
|
) |
| const |
Get a localized language name from a language code.
- Parameters
-
code | The language code as a string, either an ISO 639-1 2-letter code or an ISO 638-2 3-letter code. |
defaultValue | The string value to return is code is not found. By default, return the code string if not found. If defaultValue is an explicit empty string (""), then the empty string will be returned if code is not found. |
- Returns
- The corresponding language code or a default value if not found.
◆ countryName()
QString QtlIsoLanguages::countryName |
( |
const QString & |
code, |
|
|
const QString & |
defaultValue = QString() |
|
) |
| const |
Get a localized country name from a country code.
- Parameters
-
code | The ISO 6166-1 country code as a string, either a 2-letter, 3-letter or 3-digit code. |
defaultValue | The string value to return is code is not found. By default, return the code string if not found. If defaultValue is an explicit empty string (""), then the empty string will be returned if code is not found. |
- Returns
- The corresponding country code or a default value if not found.
◆ language2LetterCodes()
QStringList QtlIsoLanguages::language2LetterCodes |
( |
| ) |
const |
|
inline |
Get the sorted list of all ISO 639-1 2-letter codes for language names.
- Returns
- The sorted list of all ISO 639-1 2-letter codes for language names.
◆ language3LetterCodes()
QStringList QtlIsoLanguages::language3LetterCodes |
( |
| ) |
const |
|
inline |
Get the sorted list of all ISO 639-2 3-letter codes for language names.
- Returns
- The sorted list of all ISO 639-2 3-letter codes for language names.
◆ country2LetterCodes()
QStringList QtlIsoLanguages::country2LetterCodes |
( |
| ) |
const |
|
inline |
Get the sorted list of all ISO 3166 2-letter codes for country names.
- Returns
- The sorted list of all ISO 3166 2-letter codes for country names.
◆ country3LetterCodes()
QStringList QtlIsoLanguages::country3LetterCodes |
( |
| ) |
const |
|
inline |
Get the sorted list of all ISO 3166 3-letter codes for country names.
- Returns
- The sorted list of all ISO 3166 3-letter codes for country names.
◆ country3DigitCodes()
QStringList QtlIsoLanguages::country3DigitCodes |
( |
| ) |
const |
|
inline |
Get the sorted list of all ISO 3166 3-digit codes for country names.
- Returns
- The sorted list of all ISO 3166 3-digit codes for country names.
◆ codeList()
QStringList QtlIsoLanguages::codeList |
( |
const StringMap & |
map | ) |
const |
|
private |
Get the sorted list of all codes for a given map.
- Returns
- The sorted list of all codes for a given map.
◆ addLanguage()
void QtlIsoLanguages::addLanguage |
( |
const QString & |
code3, |
|
|
const QString & |
code3alt, |
|
|
const QString & |
code2, |
|
|
const QString & |
name |
|
) |
| |
|
private |
Add an ISO 639 language code.
- Parameters
-
[in] | code3 | ISO 639-1 3-letter code. |
[in] | code3alt | Optional alternate ISO 639-1 3-letter code. |
[in] | code2 | ISO 639-1 2-letter code. |
[in] | name | Language name. |
◆ addCountry()
void QtlIsoLanguages::addCountry |
( |
const QString & |
code2, |
|
|
const QString & |
code3, |
|
|
const QString & |
digit3, |
|
|
const QString & |
name |
|
) |
| |
|
private |
Add an ISO 3166-1 country code.
- Parameters
-
[in] | code2 | 2-letter code. |
[in] | code3 | 3-letter code. |
[in] | digit3 | 3-digit code. |
[in] | name | Country name. |
◆ _languageBy2Letter
StringMap QtlIsoLanguages::_languageBy2Letter |
|
private |
Map key = 2-letter code to value = language name.
◆ _languageBy3Letter
StringMap QtlIsoLanguages::_languageBy3Letter |
|
private |
Map key = 3-letter code to value = language name.
◆ _countryBy2Letter
Map key = 2-letter code to value = country name.
◆ _countryBy3Letter
Map key = 3-letter code to value = country name.
◆ _countryBy3Digit
Map key = 3-digit code to value = country name.
◆ _instance
◆ _instanceMutex
QMutex QtlIsoLanguages::_instanceMutex |
|
staticprivate |
Protect the creation of the mutex.
The documentation for this class was generated from the following files: