Add explicit encoding on manage_languages.py for windows users

This commit is contained in:
AnimeGitB 2022-07-27 20:32:44 +09:30 committed by Melledy
parent b80126fdda
commit 0e406d9f05

View File

@ -23,7 +23,7 @@ def ppprint(data):
class JsonHelpers: class JsonHelpers:
@staticmethod @staticmethod
def load(filename: str) -> dict: def load(filename: str) -> dict:
with open(filename, 'r') as file: with open(filename, 'r', encoding='utf-8') as file:
return json.load(file) return json.load(file)
@staticmethod @staticmethod
@ -117,7 +117,7 @@ class LanguageManager:
for file in files: for file in files:
if file.rpartition('.')[-1] in SOURCE_EXTENSIONS: if file.rpartition('.')[-1] in SOURCE_EXTENSIONS:
filename = os.path.join(root, file) filename = os.path.join(root, file)
with open(filename, 'r') as f: with open(filename, 'r', encoding='utf-8') as f:
data = f.read() # Loads in entire file at once data = f.read() # Loads in entire file at once
for k in self.TRANSLATION_KEY.findall(data): for k in self.TRANSLATION_KEY.findall(data):
used.add(k) used.add(k)