update tools
This commit is contained in:
parent
4cbe50dc9a
commit
e59d89abad
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
strings.dat
|
strings.dat
|
||||||
result.txt
|
*.txt
|
||||||
|
41
makeStrings.py
Normal file
41
makeStrings.py
Normal 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
2853
mods/delver-pack-ru-ru/data/strings_orig.dat
Normal file
2853
mods/delver-pack-ru-ru/data/strings_orig.dat
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,9 +14,10 @@ def loadStrings():
|
|||||||
jsonData = json.loads(f.read())
|
jsonData = json.loads(f.read())
|
||||||
|
|
||||||
for string in jsonData:
|
for string in jsonData:
|
||||||
exportData.append('%s\n%s' %
|
exportData.append('"%s":{\n"original": "%s",\n"localizedName": "%s"},' %
|
||||||
(string,
|
(string,
|
||||||
jsonData[string]['localizedName']))
|
jsonData[string]['localizedName'].replace('\n', '<N3WL1NE>'),
|
||||||
|
jsonData[string]['localizedName'].replace('\n', '<N3WL1NE>')))
|
||||||
|
|
||||||
return('Complete!')
|
return('Complete!')
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ def loadStrings():
|
|||||||
def saveStrings():
|
def saveStrings():
|
||||||
with open('result.txt', 'w+', encoding='utf-8', newline='\n') as f:
|
with open('result.txt', 'w+', encoding='utf-8', newline='\n') as f:
|
||||||
for string in exportData:
|
for string in exportData:
|
||||||
f.write('%s%s' % (string, '\n' * 3,))
|
f.write('%s%s' % (string, '\n' * 2,))
|
||||||
|
|
||||||
return('Complete!')
|
return('Complete!')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user