3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

Fix translation script for weird OS encodings

This commit is contained in:
Daniel Oaks 2018-04-01 18:31:45 +10:00
parent 3394700def
commit 379dd73b36

View File

@ -42,7 +42,7 @@ if __name__ == '__main__':
for fname in files: for fname in files:
filepath = subdir + os.sep + fname filepath = subdir + os.sep + fname
if filepath.endswith('.go'): if filepath.endswith('.go'):
content = open(filepath, 'r').read() content = open(filepath, 'r', encoding='UTF-8').read()
matches = re.findall(r'\.t\("((?:[^"]|\\")+)"\)', content) matches = re.findall(r'\.t\("((?:[^"]|\\")+)"\)', content)
for match in matches: for match in matches:
@ -64,7 +64,7 @@ if __name__ == '__main__':
for fname in files: for fname in files:
filepath = subdir + os.sep + fname filepath = subdir + os.sep + fname
if fname == 'help.go': if fname == 'help.go':
content = open(filepath, 'r').read() content = open(filepath, 'r', encoding='UTF-8').read()
matches = re.findall(r'\`([^\`]+)\`', content) matches = re.findall(r'\`([^\`]+)\`', content)
for match in matches: for match in matches:
@ -83,7 +83,7 @@ if __name__ == '__main__':
for fname in files: for fname in files:
filepath = subdir + os.sep + fname filepath = subdir + os.sep + fname
if fname == 'nickserv.go': if fname == 'nickserv.go':
content = open(filepath, 'r').read() content = open(filepath, 'r', encoding='UTF-8').read()
matches = re.findall(r'\`([^\`]+)\`', content) matches = re.findall(r'\`([^\`]+)\`', content)
for match in matches: for match in matches: