mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
l10n: Close localisation files after reading content
* These are opened in self.file() using codecs.open(), so no quick way to convert to a 'with'.
This commit is contained in:
parent
114379c8ed
commit
f2ce63bfe7
2
l10n.py
2
l10n.py
@ -131,6 +131,7 @@ class _Translations:
|
||||
"""Load all the translations from a translation file."""
|
||||
assert lang in self.available()
|
||||
translations = {}
|
||||
|
||||
h = self.file(lang, plugin_path)
|
||||
if not h:
|
||||
return {}
|
||||
@ -144,6 +145,7 @@ class _Translations:
|
||||
|
||||
elif not _Translations.COMMENT_RE.match(line):
|
||||
logger.debug(f'Bad translation: {line.strip()}')
|
||||
h.close()
|
||||
|
||||
if translations.get(LANGUAGE_ID, LANGUAGE_ID) == LANGUAGE_ID:
|
||||
translations[LANGUAGE_ID] = str(lang) # Replace language name with code if missing
|
||||
|
Loading…
x
Reference in New Issue
Block a user