1. Download our Official Android App: Forums for Android!

Apps how to translate all app text to phone language

Discussion in 'Android Development' started by dkanova, Jan 5, 2012.

  1. dkanova

    dkanova Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jan 5, 2012

    Jan 5, 2012
    2
    0
    5
    Hi, I have an app with spanish text and I would like to have it in multi languages.

    When I detect the phone language with

    Locale.getDefault().getDisplayLanguage();

    I want to translate all text to that language.

    Is it possible??

    Thanks in advance
     

    Advertisement

  2. jiminaus

    jiminaus Well-Known Member
    Rank:
    None
    Points:
    63
    Posts:
    190
    Joined:
    Oct 27, 2011

    Oct 27, 2011
    190
    36
    63
    Sydney, Australia
    You're talking about internationalization (i18n) and localization (l10n).

    You don't do this in code. You do it with resources. If you do it correctly, Android will atomically choose the correct resource to match the user's language.

    Study the Hello, L10N tutorial and read the localization dev guide.

    Basically you need to get all your UI-visible strings out of string constants in your code and layouts, and into string resources. You then have a string resource for each language.


    Oh, if you're asking if Android will translate it for you, then no. You need to translate your user interface yourself, or more usually, hire translators to do it for you.
     
  3. dkanova

    dkanova Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jan 5, 2012

    Jan 5, 2012
    2
    0
    5
    thanks for responding so quickly,
    I have all my texts in res/values/strings.xml this texts are in spanish,
    then, if I misunderstood your answerif I want to get all text in diferent languages I must have a res/values-en/strings.xml for english, res/values-fr/strings.xml for french language ... and I must do that with all device language and I must translate the texts manually

    correct?

    thanks again
     
  4. jiminaus

    jiminaus Well-Known Member
    Rank:
    None
    Points:
    63
    Posts:
    190
    Joined:
    Oct 27, 2011

    Oct 27, 2011
    190
    36
    63
    Sydney, Australia

Share This Page

Loading...