全站通知:
模块:翻译数据库/python
刷
历
编
< 模块:翻译数据库
跳到导航
跳到搜索
import sqlite3
# 日服数据库
con_JP = sqlite3.connect("master_JP.mdb")
cur_JP = con_JP.cursor()
# 繁中数据库
con_TW = sqlite3.connect("master_TW.mdb")
cur_TW = con_TW.cursor()
# 简中数据库
con_CN = sqlite3.connect("master_CN.mdb")
cur_CN = con_CN.cursor()
# 输出文件
file = open("translate.txt","w",encoding='utf-8')
file.write("local p={}\n")
def getText(category):
file.write("p.text_data_" + str(category) + "={\n")
cur_JP.execute("select * from text_data where category = %d" %category)
is_first = True
for data_JP in cur_JP:
if is_first:
is_first = False
else:
file.write(",\n")
cur_TW.execute("select * from text_data where category = %d" % category)
cur_CN.execute("select * from text_data where category = %d" % category)
text_TW =""
text_CN = ""
for data_TW in cur_TW:
if data_JP[2] == data_TW[2]:
text_TW = data_TW[3]
for data_CN in cur_CN:
if data_JP[2] == data_CN[2]:
text_CN = data_CN[3]
file.write("{id=\""+str(data_JP[0])+"\",category=\""+str(data_JP[1])+"\",index=\""+str(data_JP[2])+"\",text_JP=\""+data_JP[3]+
"\",text_TW=\""+text_TW+"\",text_CN=\""+text_CN+"\"}")
print("category="+str(category),"index="+str(data_JP[2]),"text_JP="+data_JP[3],"text_TW="+text_TW,"text_CN="+text_CN)
file.write("\n}\n")
getText(4) # 带昵称的赛马娘名
getText(5) # 赛马娘昵称
getText(6) # 赛马娘名
getText(16) # 歌曲
getText(23) # 材料名
# getText(24) # 材料说明
getText(31) # 马场名
getText(38) # 比赛名
getText(47) # 技能名
# getText(48) # 技能描述
# getText(55) # 特有名词
getText(65) # 称号
getText(75) # 支援卡全名
getText(76) # 支援卡副名
# getText(77) # 支援卡马名
# getText(88) # 赛马娘自我介绍
# getText(92) # 育成事件名
getText(111) # 比赛称号
getText(130) # 赛马娘称号
# getText(131) # 赛马娘称号获取说明
getText(147) # 因子
# getText(181) # 剧本事件名
file.write("\nreturn p")