Commit b8401008 authored by Florent Revest's avatar Florent Revest

mlite: Fix localized values when locales are long (for instance de_DE or nb_NO)

parent 26e2371c
From 0ec6c5c9751557907a93ee755ba1e5a891352dc5 Mon Sep 17 00:00:00 2001
From 5cf25750cd18c33634ef123c6375cf9c348fb685 Mon Sep 17 00:00:00 2001
From: Florent Revest <revestflo@gmail.com>
Date: Thu, 30 Nov 2017 22:02:48 +0100
Date: Sun, 18 Mar 2018 01:22:54 +0100
Subject: [PATCH] MDesktopEntry: Allow dynamic locale switch by disabling some
of the asumptions made when using glib's conf files functions
......@@ -9,7 +9,7 @@ Subject: [PATCH] MDesktopEntry: Allow dynamic locale switch by disabling some
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/mdesktopentry.cpp b/src/mdesktopentry.cpp
index cca6af0..628eaab 100644
index 3c976d5..2f25685 100644
--- a/src/mdesktopentry.cpp
+++ b/src/mdesktopentry.cpp
@@ -66,7 +66,7 @@ bool GKeyFileWrapper::load(QIODevice &device)
......@@ -25,7 +25,7 @@ index cca6af0..628eaab 100644
QByteArray section_utf8 = section.toUtf8();
QByteArray key_utf8 = key.toUtf8();
+ QByteArray locale_utf8 = QLocale().bcp47Name().toUtf8();
+ QByteArray locale_utf8 = qgetenv("LANG");
GError *err = NULL;
- gchar *value = g_key_file_get_locale_string(m_key_file, section_utf8.constData(), key_utf8.constData(), NULL, &err);
......@@ -33,7 +33,7 @@ index cca6af0..628eaab 100644
if (!value) {
qWarning() << "Could not read value:" << QString::fromUtf8(err->message);
g_clear_error(&err);
@@ -408,9 +409,6 @@ QString MDesktopEntry::name() const
@@ -411,9 +412,6 @@ QString MDesktopEntry::name() const
{
Q_D(const MDesktopEntry);
......@@ -43,7 +43,7 @@ index cca6af0..628eaab 100644
QString name;
if (contains(DesktopEntrySection, LogicalIdKey)) {
@@ -432,7 +430,6 @@ QString MDesktopEntry::name() const
@@ -435,7 +433,6 @@ QString MDesktopEntry::name() const
name = d->keyFile.localizedValue(DesktopEntrySection, NameKey);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment