Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebith/b37b71d7a64d86a0af04f0f8c964c49a to your computer and use it in GitHub Desktop.
Save ebith/b37b71d7a64d86a0af04f0f8c964c49a to your computer and use it in GitHub Desktop.
Solastaの日本語化ファイルをUnfinished Businessの翻訳システムで読み込めるようにするスクリプト
import os
import re
os.makedirs('UnofficialTranslations-ja', exist_ok=True)
with open('UnofficialTranslations-ja/Translations-ja.txt', encoding='utf-8', mode='w') as w:
number = ''
with open('I2Languages-resources.assets-71137.txt', encoding='utf-8', mode='r') as r:
for line in r:
tmp = re.search(r'(\[\d+\])', line)
if tmp:
number = tmp.group()
elif re.search(r'string Term', line):
term = line.split('=')[-1].strip().strip('"')
w.write(f'{term}=')
elif number == '[3]' and re.search(r'string Language', line):
language = line.split('=')[-1].strip().strip('"')
w.write(f'{language}\n')
@ebith
Copy link
Author

ebith commented Mar 1, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment