summaryrefslogtreecommitdiff
path: root/src/corelib/tools/qlocale_unix.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-28 12:52:17 +0100
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-28 12:52:17 +0100
commitfbf982dd12483b70947131fee1e863d9d9859a42 (patch)
tree12cdbbdb764f6ab6dc006172a5944252a702ffb7 /src/corelib/tools/qlocale_unix.cpp
parent7858c1e457a0e47029e60339b863808356caafd6 (diff)
downloadqt4-tools-fbf982dd12483b70947131fee1e863d9d9859a42.tar.gz
Fixed querying QLocale::uiLanguage on Linux.
Handle the case when the LC_MESSAGES only contains the language but not the country code. Also fixes qstring conversion - we cannot use fromRawData as the data is a local array that will be destroyed. Reviewed-by: trustme
Diffstat (limited to 'src/corelib/tools/qlocale_unix.cpp')
-rw-r--r--src/corelib/tools/qlocale_unix.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index 72eefd5b83..c4aafa0a45 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -205,8 +205,11 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
QChar cntry[3];
int lang_len, cntry_len;
if (splitLocaleName(QString::fromLatin1(d->lc_messages_var.constData(), d->lc_messages_var.size()),
- lang, cntry, &lang_len, &cntry_len))
- return QStringList(QString::fromRawData(lang, lang_len) % QLatin1Char('-') % QString::fromRawData(cntry, cntry_len));
+ lang, cntry, &lang_len, &cntry_len)) {
+ if (!cntry_len && lang_len)
+ return QStringList(QString(lang, lang_len));
+ return QStringList(QString(lang, lang_len) % QLatin1Char('-') % QString(cntry, cntry_len));
+ }
}
return QVariant();
}