2017-02-14 01:59:15 +03:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2021-01-09 17:27:44 +03:00
|
|
|
import sys
|
2017-02-14 01:59:15 +03:00
|
|
|
import json
|
|
|
|
|
|
|
|
__author__ = 'Alexander Popov'
|
2021-01-09 17:27:44 +03:00
|
|
|
__version__ = '2.0.0'
|
2017-02-14 01:59:15 +03:00
|
|
|
__license__ = 'Unlicense'
|
|
|
|
|
|
|
|
exportData = list()
|
|
|
|
|
|
|
|
|
2021-01-09 17:27:44 +03:00
|
|
|
def loadStrings(file_path):
|
|
|
|
### ###
|
|
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
2017-02-14 01:59:15 +03:00
|
|
|
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__':
|
2021-01-09 17:27:44 +03:00
|
|
|
file_path = sys.argv[1]
|
|
|
|
|
|
|
|
print('Loading strings...', loadStrings(file_path))
|
2017-02-14 01:59:15 +03:00
|
|
|
print('Save strings for notabenoid...', saveStrings())
|
|
|
|
print('\nComplete!')
|
2021-01-09 16:31:41 +03:00
|
|
|
|