Action unknown: editdoedit

nvdajp 翻訳

2012-01-19

nvdajp_modify_po

nvdajp のための作業用 python スクリプト。po ファイルに手を加える作業を、元のファイルが書き換わってもある程度自動的に行えることを目指している。

print を使うと出力がDOS改行コードになってしまうのでバイナリモードで出力している。

python nvdajp_modify_po.py source\locale\ja\LC_MESSAGES\nvda.po _new_nvda.po
copy _new_nvda.po source\locale\ja\LC_MESSAGES\nvda.po
# coding: UTF-8
# nvdajp_modify_po.py
# 2012-01-19 Takuya Nishimoto (nishimotz.com)
 
import sys
import re
 
if __name__ == '__main__':
	argvs = sys.argv
	argc = len(argvs)
	if argc != 3:
		print 'Usage: python nvdajp_modify_po src.po dest.po'
		quit()
	prev_line = None
	ifile = open(argvs[1])
	ofile = open(argvs[2], 'wb')
	for line in ifile.readlines():
		line = line.rstrip()
		org_line = line
		# capture prev_line: msgid "message" and replace
		if prev_line:
			mo = re.match(r'^msgid "(.+)"', prev_line)
			if mo:
				msgid = mo.group(1)
				#print "msgid captured: " + msgid
				if msgid == "busy":
					line = 'msgstr "使用中"' + "\n#" + line
				elif msgid == "Welcome to NVDA":
					line = 'msgstr "ようこそNVDAへ"' + "\n#" + line
				elif msgid == "Write the current configuration to nvda.ini":
					line = 'msgstr "現在の設定情報をnvda.iniに書き込む"' + "\n#" + line
		# replace message directly
		if line == r'"また、CapsLockキーをNVDAキーとして使用することもできます。\n"':
			line = r'"また、英語キーボードをお使いの場合は、CapsLockキーをNVDAキーとして使用することもできます。\n"'
		prev_line = org_line
		ofile.write(line + '\n')
	ofile.write("""		
#: gui\settingsDialogs.py:491
msgid "Reading at IME session end (nvdajp)"
msgstr "確定読み上げ(日本語IME)"
 
#: gui\settingsDialogs.py:494
msgid "Discriminant reading (nvdajp)"
msgstr "詳細読み上げ(日本語IME)"
 
#: gui\settingsDialogs.py:497
msgid "Phonetic representation reading (nvdajp)"
msgstr "フォネティック読み(日本語IME)"
 
#: gui\settingsDialogs.py:549
msgid "Support IME (nvdajp)"
msgstr "日本語IME読み上げ (設定の保存と再起動が必要)"
 
#: gui\settingsDialogs.py:552
msgid "Beep if IME mode is changed (nvdajp)"
msgstr "半角全角キーが押されたらビープ音を鳴らす(日本語IME)"
 
#: source\gui\__init__.py:416
#: source\gui\settingsDialogs.py:469
msgid "Use NonConvert as an NVDA modifier key"
msgstr "無変換キーをNVDAの制御キーとして使用"
 
#: source\gui\__init__.py:416
msgid "&Readme (nvdajp)"
msgstr "NVDA日本語版の説明"
"""
)
nvdajp_translation.txt · 最終更新: 2012/01/19 12:32 by Takuya Nishimoto
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0