From 1727c034ae8f43ba607d75503e0d9840bdf497cd Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Tue, 17 Jan 2023 10:12:33 +0800
Subject: [PATCH] fix translation of calendar

---
 plugin-calendar/lunarcalendarwidget/lunarcalendarwidget.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plugin-calendar/lunarcalendarwidget/lunarcalendarwidget.cpp b/plugin-calendar/lunarcalendarwidget/lunarcalendarwidget.cpp
index 4c5e743..40686e8 100644
--- a/plugin-calendar/lunarcalendarwidget/lunarcalendarwidget.cpp
+++ b/plugin-calendar/lunarcalendarwidget/lunarcalendarwidget.cpp
@@ -606,8 +606,8 @@ void LunarCalendarWidget::setLocaleCalendar()
 {
 
     QStringList res = getLocale();
-    qDebug()<<"设置区域:"<<res.at(0);
-    int isCN = res.at(0) == "zh_CN.UTF-8" ? 1 : 0;
+    qDebug()<<"设置区域:"<<res.at(1);
+    int isCN = res.at(1).contains("zh_CN", Qt::CaseSensitive);
     if(isCN){
         if (FirstdayisSun) {
               labWeeks.at(0)->setText("周日");
@@ -671,6 +671,8 @@ QStringList LunarCalendarWidget::getLocale()
         }
         if(language.isEmpty() && propertyMap.keys().contains("Language")) {
             language = propertyMap.find("Language").value().toString();
+	    if(language.isEmpty())
+               language = QLocale::system().name();
         }
     } else {
         qDebug() << "reply failed";
-- 
2.33.0

