Automatic string resources translate

人盡茶涼 提交于 2019-12-18 13:31:38

问题


When I run Android Lint check, I always get errors on my strings resource. The error says that I didn't translate my strings to all the languages. Assuming there are no people who know all the languages ​​in the world (if there are I'm not one of them), and that error has a realistic solution.

How can I fix this problem? Is there any way to do it automatically (like with Google Translate)?

The error is "<the-string-name>" is not translated in af, am, ar, be, bg, ca, cs, da, de, el, en-rGB, es, es-rUS, et, fa, fi, fr, hi, hr, hu, in, it, iw, ja, ko, lt, lv, ms, nb, nl, pl, pt, pt-rBR, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rTW, zu

EDIT
I know how to disable this lint error. This error exists not for you disable it...


回答1:


You can use Google Translate but in my experience this will lead to very poor quality translations. Automatic language translation is still nowhere near perfect.

To get good translations you will need humans to translate your strings for you.

Unless you have a lot of very helpful, multi-lingual friends, humans will cost you money.

There are many different translation services available online, including one recently announced from Google. It's available in Beta in your Developer Console under "Services & Apis"




回答2:


I had created a tool available at sourceforge you can use it. https://sourceforge.net/projects/androidresourcetranslator/




回答3:


Have a look here: asrt.gluege.boerde.de

  • Automated translation is indeed not failsafe, but I found that its a good starting point. If you use simple English, which is a good idea anyway, the translations are mostly OK. Also, human interpreters are faster correcting an auto-generated translation than doing it from scratch.

  • You can get an automated Google translation for a strings.xml from a simple Python script that sends URL requests. It builds on Khayam Gondal solution, but has some improvements regarding the URL handling, XML parsing and UTF8 encoding. I did this for my Android App and had some native speakers check it, they changed very little (as of 2018-04).

  • Higher-quality automatic translations for 7 European languages (DE, EN, FR, ES, IT, PL, NL) may be obtained from deepl.com, but you have to pay to use the API. If you strip the XML tags programmatically from your strings.xml and copy-paste the result on the web page you can get very good translations with little effort (and without paying money).



来源:https://stackoverflow.com/questions/17473592/automatic-string-resources-translate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!