summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-04-12 12:48:13 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-04-12 13:39:00 (GMT)
commit46163663e956b988719563eae18773a2dedd424e (patch)
tree1064cae633e56f66f7a1cc49de4720f3807284e0 /src/corelib/tools/qlocale.cpp
parent04d1cbce75e77392077ce4ae014fe8774c32a8fc (diff)
downloadQt-46163663e956b988719563eae18773a2dedd424e.zip
Qt-46163663e956b988719563eae18773a2dedd424e.tar.gz
Qt-46163663e956b988719563eae18773a2dedd424e.tar.bz2
Added support for libICU for collation and toLower/toUpper.
This patch uses icu to do string collation via QString::localeAwareCompare function and for QString::toLower/toUpper - which is important e.g. for turkish locales where uppercased 'i' is not a latin 'I'. Based on the patch by Harald Fernengel Reviewed-by: Harald Fernengel Reviewed-by: Zeno Albisser
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r--src/corelib/tools/qlocale.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index d986b9b..5c4085a 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -86,6 +86,10 @@ static QLocalePrivate *system_lp = 0;
Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate)
#endif
+#ifdef QT_USE_ICU
+extern bool qt_initIcu(const QString &localeName);
+#endif
+
/******************************************************************************
** Helpers for accessing Qt locale database
*/
@@ -520,6 +524,12 @@ void QLocalePrivate::updateSystemPrivate()
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
if (!res.isNull())
system_lp->m_plus = res.toString().at(0).unicode();
+
+#ifdef QT_USE_ICU
+ if (!default_lp)
+ qt_initIcu(system_lp->bcp47Name());
+#endif
+
}
#endif
@@ -879,6 +889,10 @@ void QLocale::setDefault(const QLocale &locale)
{
default_lp = locale.d();
default_number_options = locale.numberOptions();
+
+#ifdef QT_USE_ICU
+ qt_initIcu(locale.bcp47Name());
+#endif
}
/*!