6

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

nrofis
  • 8,975
  • 14
  • 58
  • 113
  • Read this : http://stackoverflow.com/questions/11443996/lint-how-to-ignore-key-is-not-translated-in-language-errors – Alexis C. Jul 04 '13 at 15:09
  • 1
    @ZouZou I don't want to ignore them. I want to solve them. – nrofis Jul 04 '13 at 15:10
  • 1
    What do you mean by solve ? Then just translate your string in all languages and add your strings.xml in the different folders (values-af, value-am, etc.) – Alexis C. Jul 04 '13 at 15:12
  • @ZouZou Did you read my question? I asked if there is automatic translation of doing that. – nrofis Jul 04 '13 at 15:15
  • 1
    @Someone Yes I read your question and you said _The error sais that I didn't translate my strings to all the languages. How can I fix this problem?_ So I was considering how to stop this error to show. To answer your question you can check this thread that may help: http://transmarta.blogspot.fr/2011/05/how-to-translate-android-app-having.html – Alexis C. Jul 04 '13 at 15:19

6 Answers6

10

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

Rainer Glüge
  • 1,851
  • 1
  • 15
  • 15
9

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

Khayam Gondal
  • 2,366
  • 2
  • 28
  • 40
6

I always use this amazing Android Studio Plugin AndroidLocalize

Supports up to 100+ languages and uses multiple translator support:

  • Google translator.
  • Microsoft translator.
  • Baidu translator.
  • Youdao translator.
  • Ali translator.

Usage:

  1. Right-click the string.xml file
  2. Select "Translate to other language"
Raaaaac
  • 86
  • 2
  • 6
3

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"

enter image description here

Ken Wolf
  • 23,133
  • 6
  • 63
  • 84
  • 1
    It's insanely expensive to use the translators advertised by Google – Radu Jun 25 '15 at 09:47
  • 1
    The translation in Google Play Console that uses Google Translate actually, it horrible experience for me, cost 500-600 USD for 50 languages, and the result is the same as Google Translate. – Jason Yeung Mar 06 '23 at 15:30
1

I use Google Sheets to translate string resources automatically for my app, for example, =GOOGLETRANSLATE(A4,"en","ja"), also can combine multiple cells' value into another one cell, for example =CONCATENATE(B4,C4,D4,E4,F4). My case is as follows:
A4: Play
B4: <string name="
C4: button_play
D4: ">
E4: =GOOGLETRANSLATE(A4,"en","ja")
F4: </string>
G4: =CONCATENATE(B4,C4,D4,E4,F4)
The result is shown in G4: <string name="button_play">遊ぶ</string>, then you can copy into string resource of android studio or other. you only need to replace cell A1 Play(a string of source language) and cell E4 ja(code of target language).
For detail please see https://support.google.com/docs/answer/3093331?hl=en

Jason Yeung
  • 81
  • 2
  • 5
-1

You can also use this python script. All you need is a google cloud service key: https://github.com/aljazst/Android-Strings.xml-Translator

You can find all the info in the README.md

Gre3n
  • 146
  • 1
  • 6