Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
MCTBL committed Nov 20, 2023
1 parent c969961 commit ac0266c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ Finaly will out put all entry into a new file, then you can easily translate tho
3. Input your lang file folder path
![GetPath](img/getPath.png)
![CopyIntoTerminal](img/copyIntoTermianl.png)
4. Input the sourse and your target lang file
4. Input the source and your target lang file
![InPutLangName](img/InPutLangName.png)
5. Check the new lang file in your folder, and just translate it.
![Done](img/done.png)
![NewFileWithWTTTag](img/newFileWithWTTTag.png)

## UPDATE

1. You can input `all` for source the can create all other lang in folder
![oneToALL](img/ontToAll.png)
5 changes: 5 additions & 0 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@
5. 新的语言文件将会在你指定的地址生成,使用查找即可快速翻译未翻译的条目
![Done](img/done.png)
![NewFileWithWTTTag](img/newFileWithWTTTag.png)

## 升级

1. 在输入目标语言文件的时候可以输入`all`,这将会将除了源语言文件外所有语言文件生成待翻译文件
![oneToALL](img/ontToAll.png)
12 changes: 6 additions & 6 deletions TransTool.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import os


def readFile(path, sourse, target, isALL):
def readFile(path, source, target, isALL):
count = 0
if isALL:
file = open(path + 'new\\' + "new_" + target,
mode='w', encoding="UTF8")
else:
file = open(path + "new_" + target, mode='w', encoding="UTF8")
with open(path + sourse, encoding="UTF8") as sfile:
with open(path + source, encoding="UTF8") as sfile:
for lines in sfile.readlines():
if '=' in lines:
if lines.split("=")[0] in target_dic:
Expand All @@ -30,25 +30,25 @@ def readFile(path, sourse, target, isALL):

target_dic = {}
path = input("Please input path of lang \n") + "\\"
sourse = input("Please input the souse lang(without .lang)\n") + ".lang"
source = input("Please input the souse lang(without .lang)\n") + ".lang"
target = input(
"Please input the target lang(without .lang) or just input all for others\n") + ".lang"

if 'all' in target:
if not os.path.exists(path + 'new'):
os.mkdir(path + 'new')
for lang in os.listdir(path):
if sourse in lang or os.path.isdir(path + lang):
if source in lang or os.path.isdir(path + lang):
continue
target_dic = {}
with open(path + lang, encoding="UTF8") as file:
for lines in file.readlines():
if '=' in lines:
target_dic[lines.split("=")[0]] = lines.split("=")[1]
readFile(path, sourse, lang, True)
readFile(path, source, lang, True)
else:
with open(path + target, encoding="UTF8") as file:
for lines in file.readlines():
if '=' in lines:
target_dic[lines.split("=")[0]] = lines.split("=")[1]
readFile(path, sourse, target, False)
readFile(path, source, target, False)
Binary file added img/ontToAll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ac0266c

Please sign in to comment.