Open translate language file as utf8

This commit is contained in:
shortcutme 2019-03-16 00:02:13 +01:00
parent a3ef3b34e1
commit 56d68ce161
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -58,7 +58,7 @@ class Translate(dict):
self.clear()
elif os.path.isfile(self.lang_file):
try:
data = json.load(open(self.lang_file))
data = json.load(open(self.lang_file, encoding="utf8"))
logging.debug("Loaded translate file: %s (%s entries)" % (self.lang_file, len(data)))
except Exception as err:
logging.error("Error loading translate file %s: %s" % (self.lang_file, err))
@ -102,8 +102,6 @@ class Translate(dict):
if not translate_table:
translate_table = self
data = data.decode("utf8")
patterns = []
for key, val in list(translate_table.items()):
if key.startswith("_("): # Problematic string: only match if called between _(" ") function