Last active
June 6, 2016 15:08
-
-
Save MewX/d3d3c7e44d2d56a249c1ed6b612a3a76 to your computer and use it in GitHub Desktop.
<海市蜃楼之馆> translated scripts tool.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
○title○海市蜃楼之馆 - The house in fata morgana -幕后 | |
●title● - The house in fata morgana - | |
○00000002○喂,[w]你在那里做什么呢。[l][r] | |
●00000002●[w][l][r] | |
○00000003○没错,[w]说的就是你。[p] | |
●00000003●[w][p] | |
○00000004○真奇怪,[w]又有人不请自来。[p] | |
●00000004●[w][p] | |
○00000005○……算了。[l]这时候就不计较那些琐事了。[p] | |
●00000005●[l][p] | |
○00000006○既然来到这里,[w]说明你已经解开了洋馆之谜吧?[p] | |
●00000006●[w][p] | |
○00000007○……呵呵……[w]值得夸奖。[l][r] | |
●00000007●[w][l][r] | |
○00000008○至少你有足够的耐力[w]读完这悲惨的故事。[p] | |
●00000008●[w][p] | |
○00000009○本想问问你有什么感想,[w]可惜听不到你的声音。[p] | |
●00000009●[w][p] | |
○00000010○好了,[w]既然都来了,[w]什么不在洋馆之中游览一番?[p] | |
●00000010●[w][w][p] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
○title○ファタモルガーナの館 - The house in fata morgana - 舞台裏 | |
●title● - The house in fata morgana - | |
○00000002○ちょっと、[w]そこで何をしているんですか。[l][r] | |
●00000002●[w][l][r] | |
○00000003○あなたですよ、[w]あなた。[p] | |
●00000003●[w][p] | |
○00000004○おかしいわね、[w]また呼び寄せていない者が入り込んでいるわ。[p] | |
●00000004●[w][p] | |
○00000005○……まあいいわ。[l]この際細かいことは気にしません。[p] | |
●00000005●[l][p] | |
○00000006○ここまで辿り着いたということは、[w]屋敷の謎を解き明かしたんでしょう?[p] | |
●00000006●[w][p] | |
○00000007○……フフ……、[w]褒めてあげるわ。[l][r] | |
●00000007●[w][l][r] | |
○00000008○少なくとも、[w]陰惨な物語に耐えるだけの力はあるようですから。[p] | |
●00000008●[w][p] | |
○00000009○あなたがどういう感想を抱いているのか、[w]その声が聞けなくて残念よ。[p] | |
●00000009●[w][p] | |
○00000010○さて、[w]せっかくこんなところまで迷い込んだようですから、[w]屋敷の中を巡ってみましょうか?[p] | |
●00000010●[w][w][p] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
○title○ファタモルガーナの館 - The house in fata morgana - 舞台裏 | |
●title○海市蜃楼之馆 - The house in fata morgana -幕后 | |
○00000002○ちょっと、[w]そこで何をしているんですか。[l][r] | |
●00000002○喂,[w]你在那里做什么呢。[l][r] | |
○00000003○あなたですよ、[w]あなた。[p] | |
●00000003○没错,[w]说的就是你。[p] | |
○00000004○おかしいわね、[w]また呼び寄せていない者が入り込んでいるわ。[p] | |
●00000004○真奇怪,[w]又有人不请自来。[p] | |
○00000005○……まあいいわ。[l]この際細かいことは気にしません。[p] | |
●00000005○……算了。[l]这时候就不计较那些琐事了。[p] | |
○00000006○ここまで辿り着いたということは、[w]屋敷の謎を解き明かしたんでしょう?[p] | |
●00000006○既然来到这里,[w]说明你已经解开了洋馆之谜吧?[p] | |
○00000007○……フフ……、[w]褒めてあげるわ。[l][r] | |
●00000007○……呵呵……[w]值得夸奖。[l][r] | |
○00000008○少なくとも、[w]陰惨な物語に耐えるだけの力はあるようですから。[p] | |
●00000008○至少你有足够的耐力[w]读完这悲惨的故事。[p] | |
○00000009○あなたがどういう感想を抱いているのか、[w]その声が聞けなくて残念よ。[p] | |
●00000009○本想问问你有什么感想,[w]可惜听不到你的声音。[p] | |
○00000010○さて、[w]せっかくこんなところまで迷い込んだようですから、[w]屋敷の中を巡ってみましょうか?[p] | |
●00000010○好了,[w]既然都来了,[w]什么不在洋馆之中游览一番?[p] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.nio.charset.Charset; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
// command: java Main omake.txt omake翻.txt scenario7.txt scenario7翻.txt | |
// args: f_jpn1, f_chs1, f_jpn2, f_chs2... | |
for (String a : args) { | |
System.out.println(a); | |
} | |
int fileCount = (args.length) / 2; // 1 - 0; 2 - 0; 3 - 1; | |
for (int idx = 0; idx < fileCount; idx++) { | |
String fileNameJpn = args[idx * 2], fileNameChs = args[idx * 2 + 1]; | |
System.out.println("Now proceeding " + fileNameJpn); | |
List<String> fileContentJpn = readWholeFile(fileNameJpn), fileContentChs = readWholeFile(fileNameChs); | |
if (fileContentJpn.size() != fileContentChs.size() || fileContentJpn.size() % 2 == 1) { | |
System.out.println("File line count illegal: " + fileContentJpn.size() + " vs " + fileContentChs.size()); | |
System.out.println("Skipped!"); | |
continue; | |
} | |
// do the operations | |
for (int i = 0; i < fileContentJpn.size(); i += 2) { | |
String translatedLine = fileContentJpn.get(i + 1).substring(0, fileContentJpn.get(i + 1).lastIndexOf("●")) | |
+ fileContentChs.get(i).substring(fileContentChs.get(i).lastIndexOf("○")); | |
fileContentJpn.set(i + 1, translatedLine); | |
} | |
// save file | |
String fileNameSave = fileNameJpn.substring(0, fileNameJpn.indexOf('.')) + "_converted.txt"; | |
System.out.println("Saving to " + fileNameSave); | |
saveWholeFile(fileNameSave, fileContentJpn); | |
} | |
} | |
private static List<String> readWholeFile(String fileName) throws IOException { | |
List<String> result = new ArrayList<>(); | |
File file = new File(fileName); | |
FileInputStream is = new FileInputStream(file); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-16"))); | |
while (true) { | |
String temp = reader.readLine(); | |
if(temp == null) break; | |
if(temp.length() < 5) continue; | |
result.add(temp); | |
} | |
return result; | |
} | |
private static void saveWholeFile(String fileName, List<String> fileContent) throws IOException { | |
FileOutputStream outStream = new FileOutputStream(fileName); | |
StringBuilder stringBuilder = new StringBuilder(); | |
for(int i = 0; i < fileContent.size(); i += 2) { | |
stringBuilder.append(fileContent.get(i) + "\r\n" + fileContent.get(i + 1) + "\r\n\r\n"); | |
} | |
outStream.write(stringBuilder.toString().getBytes("UTF-16")); | |
outStream.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment