update tools

This commit is contained in:
Alexander Popov 2019-05-22 02:34:09 +03:00
parent 4cbe50dc9a
commit e59d89abad
5 changed files with 2899 additions and 1691 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
strings.dat
result.txt
*.txt

41
makeStrings.py Normal file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env python3
import json
__author__ = 'Alexander Popov'
__version__ = '1.0.0'
__license__ = 'Unlicense'
# translateData = dict()
def loadTranslate():
with open('[NEW]_strings.dat.txt', 'r', encoding='utf-8') as f:
# translateData = f.read().split('\n\n')
# translateStrings = dict()
# # stringsArray = [row.strip() for row in f]
# for item in translateData:
# text = item.split('\n')
# translateStrings[text[0]] = text[1]
# # print(text)
return(json.loads(f.read()))
def replaceStrings():
with open('mods/delver-pack-ru-ru/data/strings_orig.dat', 'r', encoding='utf-8') as f:
data = json.loads(f.read())
translatedStings = loadTranslate()
for item in data:
# print(translatedStings[item])
# print(translatedStings[item])
data[item]['localizedName'] = translatedStings[item]['localizedName']
# print(translatedStings[item])
with open('strings.dat', 'w', encoding='utf-8') as f1:
json.dump(data, f1)
if __name__ == '__main__':
replaceStrings()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,9 +14,10 @@ def loadStrings():
jsonData = json.loads(f.read())
for string in jsonData:
exportData.append('%s\n%s' %
exportData.append('"%s":{\n"original": "%s",\n"localizedName": "%s"},' %
(string,
jsonData[string]['localizedName']))
jsonData[string]['localizedName'].replace('\n', '<N3WL1NE>'),
jsonData[string]['localizedName'].replace('\n', '<N3WL1NE>')))
return('Complete!')
@ -24,7 +25,7 @@ def loadStrings():
def saveStrings():
with open('result.txt', 'w+', encoding='utf-8', newline='\n') as f:
for string in exportData:
f.write('%s%s' % (string, '\n' * 3,))
f.write('%s%s' % (string, '\n' * 2,))
return('Complete!')