Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taichunmin/49465e8a8a7d5b1bd800 to your computer and use it in GitHub Desktop.
Save taichunmin/49465e8a8a7d5b1bd800 to your computer and use it in GitHub Desktop.
'''
使用這個檔案來輔助處理 DSpace 的 api, jspui 中文語系檔的更新動作
'''
msg = {}
keys = []
with open("en.txt") as enfh:
for line in enfh:
tmp = [i.strip() for i in line.strip().split("\t")]
if len(tmp)!=2:
continue
keys.append(tmp[0])
msg.setdefault(tmp[0],["",""])[0] = tmp[1];
with open("zh.txt","r",encoding="utf8") as zhfh:
for line in zhfh:
tmp = [i.strip() for i in line.strip().split("\t")]
if len(tmp)!=2:
continue
msg.setdefault(tmp[0],["",""])[1] = tmp[1];
with open("out.txt","w",encoding="utf8") as outfh:
for key in keys:
print("\t".join( [key,] + msg[key] ), file=outfh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment