4

I have an app which run in English.At the time of register i ask user to select the language or after user login he/she can change the language settings.I want to know that if user changes his/her language to any other language then he must be able to see his all content in his preferred language which he entered in English.So is there way to translate the dynamic content into user preferred language?

EDIT: I want to translate dynamic text which will come from server or any other data source not just static labels,text views text.

TechChain
  • 8,404
  • 29
  • 103
  • 228
  • 2
    You need to set local to get effect http://stackoverflow.com/questions/4985805/set-locale-programatically – QAMAR Aug 24 '15 at 07:18
  • What you mean by that "he must be able to see his all content in his preferred language which he entered in English"? – umerk44 Aug 24 '15 at 08:35
  • Ooh! i get it now, new entered dynamic text will not change his language. – umerk44 Aug 24 '15 at 08:37
  • I want text to be dynamic.If i entered something in english prevuously then it must be translated to my selected language like french,spanish. – TechChain Aug 24 '15 at 08:43
  • It's not a duplication question this question is about the dynamic text. But in the duplication question, some one mentioned (which is not it's duplicate) will replace the string file but the dynamic text will be still there in old language. – umerk44 Aug 24 '15 at 10:59
  • please tell me the solution. – TechChain Aug 24 '15 at 12:23
  • Did you find any solution ? – Mayank Bhatnagar Jan 13 '19 at 12:03

1 Answers1

0

You can many value stirng files and layour for each language that you want. For ex- layouts for english,hindi,japanese etc. This will help you to display appropraiyte content based upon the users desired language.

For example, if you want to provide some specific layout for the Arabic language and some generic layout for any other "right-to-left" language (like Persian or Hebrew) then you would have:

res/
layout/   
    main.xml  (Default layout)
layout-ar/  
    main.xml  (Specific layout for Arabic)
layout-ldrtl/  
    main.xml  (Any "right-to-left" language, except
              for Arabic, because the "ar" language qualifier
              has a higher precedence.)

you can follow this link

And you get the selected language and compare it with system language with the locale class

Community
  • 1
  • 1
RajSharma
  • 1,941
  • 3
  • 21
  • 34
  • I want dynamic text.In this case all text will be static.Like i am predefining the value.I want similar like i enter som text in text filed in english & i must be translated in french.like many of websites have translated versions. – TechChain Aug 24 '15 at 08:43
  • Indoing that you have to maintain your own database or you can use apis like google translate. – RajSharma Aug 24 '15 at 10:00