fix spinner (#36458)
This commit is contained in:
parent
d65488f293
commit
d192891a40
@ -1,10 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import gettext
|
import gettext
|
||||||
from openpilot.common.params import Params
|
|
||||||
from openpilot.common.basedir import BASEDIR
|
from openpilot.common.basedir import BASEDIR
|
||||||
from openpilot.common.swaglog import cloudlog
|
from openpilot.common.swaglog import cloudlog
|
||||||
|
|
||||||
|
try:
|
||||||
|
from openpilot.common.params import Params
|
||||||
|
except ImportError:
|
||||||
|
Params = None
|
||||||
|
|
||||||
SYSTEM_UI_DIR = os.path.join(BASEDIR, "system", "ui")
|
SYSTEM_UI_DIR = os.path.join(BASEDIR, "system", "ui")
|
||||||
UI_DIR = os.path.join(BASEDIR, "selfdrive", "ui")
|
UI_DIR = os.path.join(BASEDIR, "selfdrive", "ui")
|
||||||
TRANSLATIONS_DIR = os.path.join(UI_DIR, "translations")
|
TRANSLATIONS_DIR = os.path.join(UI_DIR, "translations")
|
||||||
@ -22,7 +26,7 @@ UNIFONT_LANGUAGES = [
|
|||||||
|
|
||||||
class Multilang:
|
class Multilang:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._params = Params()
|
self._params = Params() if Params is not None else None
|
||||||
self._language: str = "en"
|
self._language: str = "en"
|
||||||
self.languages = {}
|
self.languages = {}
|
||||||
self.codes = {}
|
self.codes = {}
|
||||||
@ -66,6 +70,7 @@ class Multilang:
|
|||||||
self.languages = json.load(f)
|
self.languages = json.load(f)
|
||||||
self.codes = {v: k for k, v in self.languages.items()}
|
self.codes = {v: k for k, v in self.languages.items()}
|
||||||
|
|
||||||
|
if self._params is not None:
|
||||||
lang = str(self._params.get("LanguageSetting")).removeprefix("main_")
|
lang = str(self._params.get("LanguageSetting")).removeprefix("main_")
|
||||||
if lang in self.codes:
|
if lang in self.codes:
|
||||||
self._language = lang
|
self._language = lang
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user