增加安装卸载多语言

This commit is contained in:
luoxueyi 2022-08-09 14:46:43 +08:00
parent 88535e219a
commit ed41d11dab
2 changed files with 31 additions and 12 deletions

View File

@ -1,6 +1,6 @@
# UpdateManager.py
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
import os
import os,apt
import apt_pkg
import sys
import time
@ -747,6 +747,7 @@ class UpdateManager():
self._is_broken = False
except KeyError:
pass
# except apt
except Exception as e:
logging.error(str(e))
self._need_downgrade = False

View File

@ -370,13 +370,22 @@ class UpdateManagerDbusController(dbus.service.Object):
if str(user_lang) == '':
logging.info("The incoming language is null...")
else:
(lang, encoding) = locale._parse_localename(str(user_lang))
(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 lang == None or lang == '':
if input_lang == None or input_lang == '':
logging.info("The incoming language is Illegal...")
if lang != os.environ["LANGUAGE"]:
logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],lang)
os.environ["LANGUAGE"] = lang
return self.parent.now_working
#处于更新和升级中的话 不进行更新
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)
sender_name = get_proc_from_dbus_name(sender)
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' DistPurgePackages Sender:%s and purge list is:%s...',sender_name,_purge_list)
@ -441,13 +450,22 @@ class UpdateManagerDbusController(dbus.service.Object):
if str(user_lang) == '':
logging.info("The incoming language is null...")
else:
(lang, encoding) = locale._parse_localename(str(user_lang))
(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 lang == None or lang == '':
if input_lang == None or input_lang == '':
logging.info("The incoming language is Illegal...")
if lang != os.environ["LANGUAGE"]:
logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],lang)
os.environ["LANGUAGE"] = lang
return self.parent.now_working
#处于更新和升级中的话 不进行更新
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)
sender_name = get_proc_from_dbus_name(sender)
self._check_prohibit_user(sender_name)
@ -750,7 +768,7 @@ class UpdateManagerDbusController(dbus.service.Object):
if not os.path.exists("/etc/kylin-version/kylin-system-version.conf"):
logging.warning("System version file doesn't exist.")
update_version,os_version = self.parent.sqlite3_server.get_default_version()
return os_version,update_version
return str(os_version),str(update_version)
os_version = str(self.parent.sqlite3_server.ucconfigs.get("SYSTEM","os_version"))
update_version = str(self.parent.sqlite3_server.ucconfigs.get("SYSTEM","update_version"))
except Exception as e: