[core] Change locale env variable order

Fixes #457
This commit is contained in:
derrod 2022-07-21 18:25:06 +02:00
parent 0d23775337
commit f26c8ab0a1

View file

@ -77,7 +77,8 @@ class LegendaryCore:
self.local_timezone = datetime.now().astimezone().tzinfo
self.language_code, self.country_code = ('en', 'US')
if locale := self.lgd.config.get('Legendary', 'locale', fallback=getdefaultlocale()[0]):
if locale := self.lgd.config.get('Legendary', 'locale',
fallback=getdefaultlocale(('LANG', 'LANGUAGE', 'LC_ALL', 'LC_CTYPE'))[0]):
try:
self.language_code, self.country_code = locale.split('-' if '-' in locale else '_')
self.log.debug(f'Set locale to {self.language_code}-{self.country_code}')