diff options
author | Mike FABIAN <mike.fabian@basyskom.de> | 2010-10-04 17:54:52 +0200 |
---|---|---|
committer | Mike FABIAN <mike.fabian@basyskom.de> | 2010-10-05 11:41:53 +0200 |
commit | 6020e084ebe0977f468cb4a738800cb19c5bccdf (patch) | |
tree | db83983bafa3a35fef92cac1b0d604a01a0004d3 /src/corelib/i18n | |
parent | 3cebdd677f6040b21cfa252cb283ccf15092c197 (diff) |
Changes: make MLocale::languageEndonym() and MLocale::countryEndonym do something reasonable without ICU
RevBy: TrustMe
Details:
QLocale does not know the endonyms, only the English names.
But it is more useful to return the English names if ICU
is not available then not having these functions at all.
Diffstat (limited to 'src/corelib/i18n')
-rw-r--r-- | src/corelib/i18n/mlocale.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp index 6ff726f8..7540613b 100644 --- a/src/corelib/i18n/mlocale.cpp +++ b/src/corelib/i18n/mlocale.cpp @@ -2495,9 +2495,9 @@ QString MLocale::weekdayName(const MCalendar &mCalendar, int weekday, } #endif -#ifdef HAVE_ICU QString MLocale::languageEndonym() const { +#ifdef HAVE_ICU UErrorCode status = U_ZERO_ERROR; QString localeName = this->name(); @@ -2566,12 +2566,15 @@ QString MLocale::languageEndonym() const } } // never reached -} +#else + Q_D(const MLocale); + return QLocale::languageToString(d->createQLocale(MLcMessages).language()); #endif +} -#ifdef HAVE_ICU QString MLocale::countryEndonym() const { +#ifdef HAVE_ICU Q_D(const MLocale); UErrorCode status = U_ZERO_ERROR; @@ -2602,8 +2605,11 @@ QString MLocale::countryEndonym() const ures_close(res); return convertedValue; -} +#else + Q_D(const MLocale); + return QLocale::countryToString(d->createQLocale(MLcMessages).country()); #endif +} #ifdef HAVE_ICU QStringList MLocale::localeScripts() const |