This commit is contained in:
Alexander Kalinovsky
2025-02-01 20:21:55 +01:00
parent a22ab9b0de
commit 1ca90c633f
6 changed files with 16 additions and 9 deletions

View File

@@ -130,15 +130,18 @@ class EnumMember(object):
return hash(self.value)
def localized(self, lang: str = None) -> str:
if self.loc_obj and len(self.loc_obj) > 0:
if lang and lang in self.loc_obj.keys():
return self.loc_obj[lang]
else:
if self.loc_obj:
if not lang:
i18n = I18n.get_current()
if i18n:
return self.loc_obj[i18n.current_locale]
lang = i18n.current_locale
else:
return self.loc_obj[list(self.loc_obj.keys())[0]]
lang = list(self.loc_obj.keys())[0]
if lang in self.loc_obj.keys():
return self.loc_obj[lang]
else:
return self.loc_obj[list(self.loc_obj.keys())[0]]
return self.value