!142 fix terminal garbled characters when not root user change locale language

From: @tanyulong2021 
Reviewed-by: @peijiankang 
Signed-off-by: @peijiankang
This commit is contained in:
openeuler-ci-bot 2023-03-21 05:50:00 +00:00 committed by Gitee
commit 12089631f5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From c7f9c64e1c920ed00f434a4acc9e687a9070208b Mon Sep 17 00:00:00 2001
From: tanyulong2021 <tanyulong@kylinos.cn>
Date: Fri, 17 Mar 2023 09:50:56 +0800
Subject: [PATCH] Fix terminal garbled characters when not root user change
locale language
---
plugins/time-language/area/area.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/plugins/time-language/area/area.cpp b/plugins/time-language/area/area.cpp
index df6834d..58704ec 100644
--- a/plugins/time-language/area/area.cpp
+++ b/plugins/time-language/area/area.cpp
@@ -184,7 +184,7 @@ void Area::initLanguage()
QStringList res = getUserDefaultLanguage();
QString lang = res.at(1);
- int langIndex = lang.split(':').at(0) == "zh_CN" ? 0 : 1;
+ int langIndex = lang.split(':').at(0) == "zh_CN.UTF-8" ? 0 : 1;
if (0 == langIndex) {
chineseFrame->showSelectedIcon(true);
@@ -201,13 +201,13 @@ void Area::initLanguage()
connect(chineseFrame, &LanguageFrame::clicked, this, [=](){
englishFrame->showSelectedIcon(false);
- m_areaInterface->call("SetLanguage","zh_CN");
+ m_areaInterface->call("SetLanguage","zh_CN.UTF-8");
showMessageBox(2);
});
connect(englishFrame, &LanguageFrame::clicked, this, [=](){
chineseFrame->showSelectedIcon(false);
- m_areaInterface->call("SetLanguage","en_US");
+ m_areaInterface->call("SetLanguage","en_US.UTF-8");
showMessageBox(2);
});
}
@@ -218,7 +218,7 @@ void Area::initComponent() {
QStringList res = getUserDefaultLanguage();
QString lang = res.at(1);
- int langIndex = lang.split(':').at(0) == "zh_CN" ? 1 : 0;
+ int langIndex = lang.split(':').at(0) == "zh_CN.UTF-8" ? 1 : 0;
int formatIndex = res.at(0) == "zh_CN.UTF-8" ? 1 : 0;
// ui->langcomboBox->setCurrentIndex(langIndex);
ui->countrycomboBox->setCurrentIndex(formatIndex);
@@ -344,6 +344,8 @@ QStringList Area::getUserDefaultLanguage() {
}
if(language.isEmpty() && propertyMap.keys().contains("Language")) {
language = propertyMap.find("Language").value().toString();
+ if(language.isEmpty())
+ language = QLocale::system().name()+ ".UTF-8";
}
} else {
qDebug() << "reply failed";
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: ukui-control-center
Version: 3.1.2
Release: 12
Release: 13
Summary: utilities to configure the UKUI desktop
License: GPL-2+
URL: http://www.ukui.org
@ -14,6 +14,7 @@ Patch08: ukui-control-center-3.0.4-fix-invalid-automatic-login.patch
Patch10: 0010-Fix-the-problem-of-scrambled-shortcut-keys.patch
Patch11: 0011-Fix-about-copyright-display-error.patch
Patch12: 0012-fix-add-group-failed-issue.patch
Patch13: 0013-Fix-terminal-garbled-characters-when-not-root-user-change-locale-language.patch
BuildRequires: qt5-qtsvg-devel
BuildRequires: gsettings-qt-devel
@ -139,6 +140,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Mar 17 2023 tanyulong <tanyulong@kylinos.cn> - 3.1.2-13
- Fix terminal garbled characters when not root user change locale language
* Wed Mar 01 2023 peijiankang <peijiankang@kylinos.cn> - 3.1.2-12
- add build debuginfo and debugsource