summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qcollator_icu.cpp3
-rw-r--r--src/corelib/tools/qcollator_macx.cpp5
-rw-r--r--src/corelib/tools/qcollator_win.cpp3
-rw-r--r--src/corelib/tools/qlocale_p.h3
4 files changed, 11 insertions, 3 deletions
diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp
index 3cde3051b4..98bed1fbca 100644
--- a/src/corelib/tools/qcollator_icu.cpp
+++ b/src/corelib/tools/qcollator_icu.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "qcollator_p.h"
+#include "qlocale_p.h"
#include "qstringlist.h"
#include "qstring.h"
@@ -56,7 +57,7 @@ void QCollatorPrivate::init()
cleanup();
UErrorCode status = U_ZERO_ERROR;
- QByteArray name = locale.bcp47Name().replace(QLatin1Char('-'), QLatin1Char('_')).toLatin1();
+ QByteArray name = QLocalePrivate::get(locale)->bcp47Name('_');
collator = ucol_open(name.constData(), &status);
if (U_FAILURE(status)) {
qWarning("Could not create collator: %d", status);
diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp
index b4d93e58d4..c4eb8e6978 100644
--- a/src/corelib/tools/qcollator_macx.cpp
+++ b/src/corelib/tools/qcollator_macx.cpp
@@ -38,9 +38,12 @@
****************************************************************************/
#include "qcollator_p.h"
+#include "qlocale_p.h"
#include "qstringlist.h"
#include "qstring.h"
+
#include <QtCore/private/qcore_mac_p.h>
+
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFLocale.h>
@@ -53,7 +56,7 @@ void QCollatorPrivate::init()
{
cleanup();
LocaleRef localeRef;
- int rc = LocaleRefFromLocaleString(locale.bcp47Name().toLocal8Bit(), &localeRef);
+ int rc = LocaleRefFromLocaleString(QLocalePrivate::get(locale)->bcp47Name().constData(), &localeRef);
if (rc != 0)
qWarning("couldn't initialize the locale");
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index fcd8d069eb..44beaeaf75 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qcollator_p.h"
+#include "qlocale_p.h"
#include "qstringlist.h"
#include "qstring.h"
@@ -61,7 +62,7 @@ void QCollatorPrivate::init()
collator = 0;
#ifndef USE_COMPARESTRINGEX
- localeID = qt_inIsoNametoLCID(locale.bcp47Name().toUtf8().constData());
+ localeID = qt_inIsoNametoLCID(QLocalePrivate::get(locale)->bcp47Name().constData());
#else
localeName = locale.bcp47Name();
#endif
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index 7749f66b8e..f7adb021b6 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -332,6 +332,9 @@ public:
return retval;
}
+ static QLocalePrivate *get(QLocale &l) { return l.d; }
+ static const QLocalePrivate *get(const QLocale &l) { return l.d; }
+
QChar decimal() const { return QChar(m_data->m_decimal); }
QChar group() const { return QChar(m_data->m_group); }
QChar list() const { return QChar(m_data->m_list); }