summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r--src/corelib/tools/qlocale.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 4648ca1..ca8cc8a 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -76,7 +76,6 @@ QT_BEGIN_NAMESPACE
#if defined(Q_OS_SYMBIAN)
void qt_symbianUpdateSystemPrivate();
-void qt_symbianInitSystemLocale();
#endif
#ifndef QT_NO_SYSTEMLOCALE
@@ -470,9 +469,6 @@ static const QSystemLocale *systemLocale()
{
if (_systemLocale)
return _systemLocale;
-#if defined(Q_OS_SYMBIAN)
- qt_symbianInitSystemLocale();
-#endif
return QSystemLocale_globalSystemLocale();
}
@@ -942,19 +938,32 @@ QLocale::Country QLocale::country() const
QString QLocale::name() const
{
- Language l = language();
+ const QLocalePrivate *dd = d();
- QString result = d()->languageCode();
+ if (dd->m_language_id == QLocale::AnyLanguage)
+ return QString();
+ if (dd->m_language_id == QLocale::C)
+ return QLatin1String("C");
- if (l == C)
- return result;
+ const unsigned char *c = language_code_list + 3*(uint(dd->m_language_id));
- Country c = country();
- if (c == AnyCountry)
- return result;
+ QString result(7, Qt::Uninitialized);
+ ushort *data = (ushort *)result.unicode();
+ const ushort *begin = data;
- result.append(QLatin1Char('_'));
- result.append(d()->countryCode());
+ *data++ = ushort(c[0]);
+ *data++ = ushort(c[1]);
+ if (c[2] != 0)
+ *data++ = ushort(c[2]);
+ if (dd->m_country_id != AnyCountry) {
+ *data++ = '_';
+ const unsigned char *c = country_code_list + 3*(uint(dd->m_country_id));
+ *data++ = ushort(c[0]);
+ *data++ = ushort(c[1]);
+ if (c[2] != 0)
+ *data++ = ushort(c[2]);
+ }
+ result.resize(data - begin);
return result;
}