Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old January 5th, 2012, 03:49 AM   #1 (permalink)
New Member
 
Join Date: Jan 2012
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to translate all app text to phone language

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

dkanova is offline  
Reply With Quote
Sponsors
Old January 5th, 2012, 03:59 AM   #2 (permalink)
Premium Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Thanks: 2
Thanked 37 Times in 33 Posts
Default

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.
jiminaus is offline  
Last edited by jiminaus; January 5th, 2012 at 04:03 AM.
Reply With Quote
Old January 5th, 2012, 04:08 AM   #3 (permalink)
New Member
 
Join Date: Jan 2012
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
dkanova is offline  
Reply With Quote
Old January 5th, 2012, 04:12 AM   #4 (permalink)
Premium Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Thanks: 2
Thanked 37 Times in 33 Posts
Default

Correct.
jiminaus is offline  
Reply With Quote
Reply

Bookmarks

Tags
multi language, text


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:21 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo