纷争终结者-解读翻译文件
This commit is contained in:
parent
2a24770e7a
commit
a3610aab39
@ -0,0 +1,46 @@
|
||||
package com.huzhujiang.troubleshooter;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AnalyzeTranslateFile {
|
||||
|
||||
private static final String path = "F:\\BaiduNetdiskDownload\\纷争终结者:被遗弃的孩子\\v20250207\\Troubleshooter v20250207\\Dictionary\\chn";
|
||||
|
||||
public static void initAllTranslateFile(Map<String, String> map) {
|
||||
analyzeTranslateFile("dic_keyword.dic", map);
|
||||
analyzeTranslateFile("dic_keyword.dic", map);
|
||||
}
|
||||
|
||||
public static void analyzeTranslateFile(String fileName, Map<String, String> map) {
|
||||
List<String> linesStr = FileUtil.readUtf8Lines(path + "\\" + fileName);
|
||||
for (int i = 0; i < linesStr.size(); i++) {
|
||||
String line = linesStr.get(i);
|
||||
// #377 [!Buff]분노 [!Buff]愤怒
|
||||
// #379 [!Buff]부활 [!Buff]复活
|
||||
if (line.startsWith("#") && line.indexOf('[') != -1) {
|
||||
String tmpStr = line.substring(line.indexOf('['), line.indexOf(']') + 1);
|
||||
if (line.indexOf(tmpStr) == line.lastIndexOf(tmpStr)) {
|
||||
// System.err.println("错误的解析行数:" + i +" -- 内容:" + line);
|
||||
String oriStr1 = line.substring(line.indexOf(tmpStr) + tmpStr.length(), line.lastIndexOf("\t"));
|
||||
String chnStr1 = line.substring(line.lastIndexOf("\t") + 1);
|
||||
map.put(oriStr1, chnStr1);
|
||||
// System.out.println("原文:" + oriStr1 + " --> 翻译后:" + chnStr1);
|
||||
continue;
|
||||
}
|
||||
String oriStr = line.substring(line.indexOf(tmpStr) + tmpStr.length(), line.lastIndexOf(tmpStr));
|
||||
String chnStr = line.substring(line.lastIndexOf(tmpStr) + tmpStr.length());
|
||||
// System.out.println("原文:" + oriStr + " --> 翻译后:" + chnStr);
|
||||
map.put(oriStr, chnStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// analyzeTranslateFile("dic_keyword.dic");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user