Pyliguist
A python script translates Qt ts file by google translateRecently I'm working on project Qucs. This project only has a little group of developers.
The program got about 3000 entries need to be translated, which, however, no one wants to translate them. To translate them manually is a very hard, and time-consuming work. It makes me think of using Python to translate these text automatically.
Luckily, there do have an automatic tool: Python Goslate package.
It's very simple to use, just create a goslate object. Then you can call function translate to translate the text, like this:
>>>go="goslate.Goslate()
>>>go.translate(“worship”, “zh-tw”)
崇拜
>>>go.translate(“worship”, “zh-tw”)
崇拜
I write a little script “PyLinguist” in Python, which use Python “xml” to parse Qt translation file. Then use Python package “Goslate” to translate the text.
It takes 30 seconds to translate 200 entries in test file, which is much faster than translate manually. Though there is some problem. For example it translate “Help” into “Save me” in Chinese, but generally it works.
The source code is here:
www.github.com/yodalee/PyLinguist
沒有留言:
張貼留言