21 #include "localizationinfo.h" 24 #include <QStringList> 31 "",
"system",
"system default" 35 "GBR",
"en",
"English" 39 const QList<LocalizationInfo> &candidates,
40 const QString &localeName)
45 LocaleMatch matchScore = matchLocale(candidate.localeName, localeName);
48 case LocaleMatchCompletely:
50 case LocaleMatchLanguage:
51 matchLanguage = candidate;
61 bool LocalizationInfo::isValid()
const 63 return !localeName.isEmpty();
69 && QLocale(localeName) == QLocale(o2.
localeName)
73 QString LocalizationInfo::toString()
const 80 LocaleMatch matchLocale(
const QString &localeName1,
const QString &localeName2)
82 if (localeName1.compare(localeName2, Qt::CaseInsensitive) == 0)
83 return LocaleMatchCompletely;
84 else if (localeName1.split(
"_")[0].compare(localeName2.split(
"_")[0], Qt::CaseInsensitive) == 0)
85 return LocaleMatchLanguage;
QString localeName
Compliant with language_country standard. See QLocale::name()
QString niceName
Name that will be displayed to user.
QString countryCodeName
The same as code used for country flags in IP2C.
static const LocalizationInfo PROGRAM_NATIVE
static const LocalizationInfo SYSTEM_FOLLOW