delver/notabenoidSplit.py

36 lines
1018 B
Python
Raw Normal View History

2017-02-14 01:59:15 +03:00
#!/usr/bin/env python3
import json
__author__ = 'Alexander Popov'
2017-02-14 02:03:22 +03:00
__version__ = '1.0.0'
2017-02-14 01:59:15 +03:00
__license__ = 'Unlicense'
exportData = list()
def loadStrings():
with open('strings.dat', 'r', encoding='utf-8') as f:
jsonData = json.loads(f.read())
for string in jsonData:
2019-05-22 02:34:09 +03:00
exportData.append('"%s":{\n"original": "%s",\n"localizedName": "%s"},' %
2017-02-14 02:03:22 +03:00
(string,
2019-05-22 02:34:09 +03:00
jsonData[string]['localizedName'].replace('\n', '<N3WL1NE>'),
jsonData[string]['localizedName'].replace('\n', '<N3WL1NE>')))
2017-02-14 01:59:15 +03:00
return('Complete!')
def saveStrings():
2017-02-14 02:03:22 +03:00
with open('result.txt', 'w+', encoding='utf-8', newline='\n') as f:
2017-02-14 01:59:15 +03:00
for string in exportData:
2019-05-22 02:34:09 +03:00
f.write('%s%s' % (string, '\n' * 2,))
2017-02-14 01:59:15 +03:00
return('Complete!')
if __name__ == '__main__':
print('Loading strings...', loadStrings())
print('Save strings for notabenoid...', saveStrings())
print('\nComplete!')