Use LC_MESSAGES instead of LC_NUMERIC in QSystemLocale::fallbackLocale()

commit b9790a04ee
(https://codereview.qt-project.org/24304) introduced the problem that
the country gets initialized from LC_NUMERIC and the language from
LC_MESSAGES. For example, if LC_NUMERIC=ru_RU and LC_MESSAGE=fr_FR,
then QLocale::system().name() returns "fr_RU". It is not nice to mix
the values of two LC_ variables there. Therefore, revert this change
and use LC_MESSAGES instead of LC_NUMERIC in
QSystemLocale::fallbackLocale(). This was also suggested in the
changelog of b9790a04 and it looks like a better way to fix the
problem.

Change-Id: I8fa6fec2b33e9f1f5a31c4b288503a658dad6d30
Reviewed-by: Denis Dzyubenko
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
bb10
Mike FABIAN 2012-06-04 09:50:07 +02:00 committed by Qt by Nokia
parent 66a0b8446d
commit 7dfee3ffc5
1 changed files with 1 additions and 3 deletions

View File

@ -114,7 +114,7 @@ QLocale QSystemLocale::fallbackLocale() const
{
QByteArray lang = qgetenv("LC_ALL");
if (lang.isEmpty())
lang = qgetenv("LC_NUMERIC");
lang = qgetenv("LC_MESSAGES");
if (lang.isEmpty())
lang = qgetenv("LANG");
return QLocale(QString::fromLatin1(lang));
@ -242,8 +242,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
return lc_messages.createSeparatedList(in.value<QStringList>());
case LocaleChanged:
Q_ASSERT(false);
case LanguageId:
return lc_messages.language();
default:
break;
}