Make comment() work in the C locale too.

The parser makes the default language en_US, and no mimetype xml says
<comment xml:lang="C">, so use the en_US string for the C locale,
rather than returning an empty string.

Change-Id: Iad7c142e8078abe357773249416e7ce9b3e29a92
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2012-03-21 10:03:26 +01:00 committed by Qt by Nokia
parent 5ec5ce3549
commit f89bf2c153
2 changed files with 3 additions and 2 deletions

View File

@ -282,7 +282,8 @@ QString QMimeType::comment() const
QStringList languageList;
languageList << QLocale::system().name();
languageList << QLocale::system().uiLanguages();
Q_FOREACH (const QString &lang, languageList) {
Q_FOREACH (const QString &language, languageList) {
const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language;
const QString comm = d->localeComments.value(lang);
if (!comm.isEmpty())
return comm;

View File

@ -56,7 +56,7 @@ static const char yastFileName[] ="yast2-metapackage-handler-mimetypes.xml";
void initializeLang()
{
qputenv("LC_ALL", "");
qputenv("LANG", "en_US");
qputenv("LANG", "C");
QCoreApplication::setApplicationName("tst_qmimedatabase"); // temporary directory pattern
}