Merge branch 'backend_manual' into 'backend_uu'

同步处理多语言lan和language语言的不同步问题

See merge request kylin-desktop/update-manager-group/kylin-system-updater!456
This commit is contained in:
网松 2022-07-18 07:22:24 +00:00
commit 628fe44d47
3 changed files with 9 additions and 12 deletions

View File

@ -219,22 +219,19 @@ class UpdateManagerDbusController(dbus.service.Object):
else:
(input_lang, encoding) = locale._parse_localename(str(user_lang))
(local_lang, encoding) = locale._parse_localename(str(os.environ["LANG"]))
(local_language, encoding) = locale._parse_localename(str(os.environ["LANGUAGE"]))
#合法性的校验
if input_lang == None or input_lang == '':
logging.info("The incoming language is Illegal...")
return self.parent.now_working
if local_lang == None or local_lang == '':
logging.info("The incoming language is Illegal...")
return self.parent.now_working
#处于更新和升级中的话 不进行更新
if input_lang != os.environ["LANGUAGE"] or input_lang != local_lang:
logging.warning("LANG: switched %s to %s",os.environ["LANG"],input_lang)
logging.warning("LANGUAGE: switched %s to %s",os.environ["LANGUAGE"],input_lang)
os.environ["LANG"] = input_lang
os.environ["LANGUAGE"] = input_lang
if input_lang != local_language or input_lang != local_lang:
logging.warning("LANG: switched %s to %s",os.environ["LANG"],user_lang)
logging.warning("LANGUAGE: switched %s to %s",os.environ["LANGUAGE"],user_lang)
os.environ["LANG"] = user_lang
os.environ["LANGUAGE"] = user_lang
self.parent.aptd_lang_switch = True
reload(enums)

View File

@ -37,10 +37,10 @@ class InstallBackendAptdaemon(InstallBackend):
self.window_main = window_main
#切换aptdaemon的语言 重新导入模块就可以进行切换
if self.window_main.aptd_lang_switch == True:
self.window_main.aptd_lang_switch = False
reload(client)
reload(errors)
reload(enums)
self.window_main.aptd_lang_switch = False
#客户端连接aptdeamon的dbus接口
self.client = client.AptClient()

View File

@ -73,9 +73,9 @@ if __name__ == "__main__":
#做一些规范处理
if os.environ["LANGUAGE"] == "en":
os.environ["LANGUAGE"] = "en_US"
os.environ["LANGUAGE"] = "en_US.UTF-8"
if os.environ["LANGUAGE"] == "zh_CN:en" or os.environ["LANGUAGE"] == "zh_CN:zh":
os.environ["LANGUAGE"] = "zh_CN"
os.environ["LANGUAGE"] = "zh_CN.UTF-8"
# ensure that we are not killed when the terminal goes away e.g. on
# shutdown