-1

I have an Android project that I developed one year ago. I didn't think in do the project multi-language and now I need support it.

There are any easy way to detect all strings and generate the XML file? Or I need modify the project string for string?

The project is developed in Eclipse.

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
Millas
  • 82
  • 2
  • 9
  • 2
    possible duplicate of [How can I create a multilingual android application?](http://stackoverflow.com/questions/4259128/how-can-i-create-a-multilingual-android-application) – Thomas Aug 25 '14 at 07:12
  • Thank you @Thomas, I knew Android support it and how create it. But I need some way to detect the strings in the project and convert in resources strings to do the application multilenguaje. – Millas Aug 25 '14 at 09:25
  • As far as I understand you have to set each string you want to be multilanguage as a "String object" such as `R.string.my_string_name` or `@string/my_string_name` as @Frank N. Stein points. I dont think that there is some other way. Intenationalization eclipse plugins for example seem to follow the same approach – Thomas Aug 25 '14 at 09:58

2 Answers2

1

Android provides a very simple way to localize apps: string resources.

You need to provide several strings.xml files.
Each in a directory called /res/values-xy, where xy is the language (i.e.: es, fr, en, de, it, ...).

Then just refer these strings in your project, like R.string.my_string_name (in Java) or @string/my_string_name (in xml)

For reference: http://developer.android.com/training/basics/supporting-devices/languages.html

[EDIT]

Same goes for arrays: just use /res/values-xy/arrays.xml


Note: the names strings.xml and arrays.xml are just conventional ones can be changed to anything you like better.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
0

AFAIK You need to modify the strings in your project manually. If you have hard-coded strings in your layouts then you can use Lint to find out all the hard-coded strings. Put them then into values/strings and the translation should go to the respective folder of each language.

EDIT:

If you're running Eclipse you can use the search feature to help you track all your hard-coded String. Check this topic

Community
  • 1
  • 1
113408
  • 3,364
  • 6
  • 27
  • 54
  • Lint solve me the strings in XML files, but I have strings in the code too, and the tool don't detect it. – Millas Aug 25 '14 at 09:39