Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic string resources translate

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...

like image 596
nrofis Avatar asked Jul 04 '13 15:07

nrofis


People also ask

Is there an automatic translator?

Google Translate works on iOS/iPadOS and Android devices. iPhone and iPad users will find it at Apple's App Store(Opens in a new window), while Android users can snag it from Google Play(Opens in a new window).

How do I translate a string?

The translate() method returns a string where some specified characters are replaced with the character described in a dictionary, or in a mapping table. Use the maketrans() method to create a mapping table. If a character is not specified in the dictionary/table, the character will not be replaced.


1 Answers

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).

like image 188
Rainer Glüge Avatar answered Sep 23 '22 01:09

Rainer Glüge