Re: [android-developers] Re: Dynamically changing the language at runtime
Related to this same question, if it is not supported to change the locale outside of the built-in OS configurations, how can I request a language specific soft keyboard on-the-fly? I don't necessarily need code, just a push in the right direction. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Dynamically changing the language at runtime
> > I know this is a pretty old thread, but I'm curious if it is still the > contention of the team at Google that changing the language at runtime is a > bad idea? If so, what are my alternatives? I am doing a kisosk > application for a corporate customer so I can't fire the intent to bring up > the OS config menu. I did a similar product on an embedded Windows > (shudder) system a few years ago and we basically just implemented our own > getString(prompt_id, sel_lang) call along with a structure of flat files to > represent the different languages supported. I suppose the same approach > is doable on Android but I'm curious if there is something already there > that I could/should be doing. Thanks! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Dynamically changing the language at runtime
Like I said, there isn't really a way. You are doing stuff that isn't really supported, so you're going to be hacking around. Forcibly changing the configuration of resources is already a hack -- for example if the user flips the lid the configuration will change, blowing away what you set. I probably shouldn't have said anything. :} On Mon, Feb 9, 2009 at 12:39 PM, Evgeny V wrote: > So, what can be a best way to restart the app except to ask user restart > manually? > > Thanks, > Evgeny > > On Mon, Feb 9, 2009 at 9:49 PM, Dianne Hackborn wrote: > >> You will need to do all of the UI recreation in your activity. We don't >> currently have a way for an activity to ask that it be restarted, sorry. >> Like I said, this isn't really supported. >> >> >> On Mon, Feb 9, 2009 at 11:29 AM, Mark Nuetzmann > > wrote: >> >>> >>> I have a settings dialog/activity where I allow the user to change the >>> locale. Within that activity i call >>> >>>Resources res = ctx.getResources(); >>>// Change locale settings on the device >>>DisplayMetrics dm = res.getDisplayMetrics(); >>>android.content.res.Configuration conf = >>> res.getConfiguration(); >>>conf.locale = new Locale(language_code.toLowerCase(), >>> coutry_code.toUpperCase()); >>>res.updateConfiguration(conf, dm); >>> >>> and call onChanged() for my settings ListView... everything changes >>> perfectly. Very nice. >>> >>> Then I hit the back button to go back to the previous activity >>> thinking everything should be switched; nope. Everything is still in >>> the previous locale. So I added the above code in the onResume() of >>> the activity thinking that would do it; nope. Also, when I click the >>> menu button of this activity again (not first time) I do not get >>> called in onCreateOptionsMenu() it just displays the previous menu. >>> >>> My question is what is the correct way to force existing activities to >>> reload using the new local? >>> >>> thanks. >>> Mark >>> >>> >>> On Jan 26, 10:39 pm, Raja Nagendra Kumar >>> wrote: >>> > Diannel thank you, Deep thank you for the complete source spippet.. >>> > >>> > On Jan 27, 1:23 am, "deepdr...@googlemail.com" >>> > >>> > wrote: >>> > > ya, great, thanks, this works for me ! : >>> > >>> > > Resources res = getResources(); >>> > > DisplayMetrics dm = res.getDisplayMetrics(); >>> > > Configuration conf = res.getConfiguration(); >>> > > conf.locale = Locale.GERMANY; >>> > > res.updateConfiguration(conf, dm); >>> > > firstline= res.getString(R.string.firstline); >>> > >>> > > On Jan 26, 9:09 pm, Dianne Hackborn wrote: >>> > >>> > > > You can't just modify the structure, you need to give a new >>> Configuration of >>> > > > new values to Resources.updateConfiguration(). >>> > >>> > > > On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < >>> > >>> > > > deepdr...@googlemail.com> wrote: >>> > >>> > > > > I tried : >>> > >>> > > > >Resources res = getResources(); >>> > > > >res.getConfiguration().locale = Locale.GERMANY; >>> > > > >firstline= res.getString(R.string.firstline); >>> > >>> > > > > in my onCreate() . But, although I do have >>> res/values-de/strings.xml >>> > > > > this still gives me the english string for firstline. >>> > > > > So it seems to me that there's no easy way to test different >>> languages >>> > > > > without an actual device for that language (?) >>> > >>> > > > > On Jan 24, 10:28 pm, Dianne Hackborn >>> wrote: >>> > > > > > This isn't really supported, though you can change the language >>> of the >>> > > > > > Configuration used by your Resources object. This will only >>> impact your >>> > > > > own >>> > > > > > app, though, not things displayed by others like your >>> notifications >>> > > > > (those >>> > > > > > will still use the system's locale). >>> > >>> > > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < >>> > >>> > > > > > nagendra.r...@gmail.com> wrote: >>> > >>> > > > > > > Hi Romain, >>> > >>> > > > > > > Thank You Romain, a follow up to this how do I change the >>> default >>> > > > > > > languge to choose in my application based on the menu we >>> provide with >>> > > > > > > in the andorid application.. >>> > > > > > > I may still want to keep my phone locale some thing deferent >>> than the >>> > > > > > > application locale. >>> > >>> > > > > > > Regards, >>> > > > > > > Nagendra >>> > >>> > > > > > > On Jan 24, 11:16 am, Romain Guy >>> wrote: >>> > > > > > > > Hi, >>> > >>> > > > > > > > All you need to do is place your resources in locale >>> specific >>> > > > > > > > directories. For instance: >>> > >>> > > > > > > > res\ >>> > > > > > > > drawable-en\ >>> > > > > > > > values-fr\ >>> > > > > > > > layout-jp\ >>> > >>> > > > > > > > In your example to localize the app in English and Germa
[android-developers] Re: Dynamically changing the language at runtime
So, what can be a best way to restart the app except to ask user restart manually? Thanks, Evgeny On Mon, Feb 9, 2009 at 9:49 PM, Dianne Hackborn wrote: > You will need to do all of the UI recreation in your activity. We don't > currently have a way for an activity to ask that it be restarted, sorry. > Like I said, this isn't really supported. > > > On Mon, Feb 9, 2009 at 11:29 AM, Mark Nuetzmann > wrote: > >> >> I have a settings dialog/activity where I allow the user to change the >> locale. Within that activity i call >> >>Resources res = ctx.getResources(); >>// Change locale settings on the device >>DisplayMetrics dm = res.getDisplayMetrics(); >>android.content.res.Configuration conf = >> res.getConfiguration(); >>conf.locale = new Locale(language_code.toLowerCase(), >> coutry_code.toUpperCase()); >>res.updateConfiguration(conf, dm); >> >> and call onChanged() for my settings ListView... everything changes >> perfectly. Very nice. >> >> Then I hit the back button to go back to the previous activity >> thinking everything should be switched; nope. Everything is still in >> the previous locale. So I added the above code in the onResume() of >> the activity thinking that would do it; nope. Also, when I click the >> menu button of this activity again (not first time) I do not get >> called in onCreateOptionsMenu() it just displays the previous menu. >> >> My question is what is the correct way to force existing activities to >> reload using the new local? >> >> thanks. >> Mark >> >> >> On Jan 26, 10:39 pm, Raja Nagendra Kumar >> wrote: >> > Diannel thank you, Deep thank you for the complete source spippet.. >> > >> > On Jan 27, 1:23 am, "deepdr...@googlemail.com" >> > >> > wrote: >> > > ya, great, thanks, this works for me ! : >> > >> > > Resources res = getResources(); >> > > DisplayMetrics dm = res.getDisplayMetrics(); >> > > Configuration conf = res.getConfiguration(); >> > > conf.locale = Locale.GERMANY; >> > > res.updateConfiguration(conf, dm); >> > > firstline= res.getString(R.string.firstline); >> > >> > > On Jan 26, 9:09 pm, Dianne Hackborn wrote: >> > >> > > > You can't just modify the structure, you need to give a new >> Configuration of >> > > > new values to Resources.updateConfiguration(). >> > >> > > > On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < >> > >> > > > deepdr...@googlemail.com> wrote: >> > >> > > > > I tried : >> > >> > > > >Resources res = getResources(); >> > > > >res.getConfiguration().locale = Locale.GERMANY; >> > > > >firstline= res.getString(R.string.firstline); >> > >> > > > > in my onCreate() . But, although I do have >> res/values-de/strings.xml >> > > > > this still gives me the english string for firstline. >> > > > > So it seems to me that there's no easy way to test different >> languages >> > > > > without an actual device for that language (?) >> > >> > > > > On Jan 24, 10:28 pm, Dianne Hackborn wrote: >> > > > > > This isn't really supported, though you can change the language >> of the >> > > > > > Configuration used by your Resources object. This will only >> impact your >> > > > > own >> > > > > > app, though, not things displayed by others like your >> notifications >> > > > > (those >> > > > > > will still use the system's locale). >> > >> > > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < >> > >> > > > > > nagendra.r...@gmail.com> wrote: >> > >> > > > > > > Hi Romain, >> > >> > > > > > > Thank You Romain, a follow up to this how do I change the >> default >> > > > > > > languge to choose in my application based on the menu we >> provide with >> > > > > > > in the andorid application.. >> > > > > > > I may still want to keep my phone locale some thing deferent >> than the >> > > > > > > application locale. >> > >> > > > > > > Regards, >> > > > > > > Nagendra >> > >> > > > > > > On Jan 24, 11:16 am, Romain Guy wrote: >> > > > > > > > Hi, >> > >> > > > > > > > All you need to do is place your resources in locale >> specific >> > > > > > > > directories. For instance: >> > >> > > > > > > > res\ >> > > > > > > > drawable-en\ >> > > > > > > > values-fr\ >> > > > > > > > layout-jp\ >> > >> > > > > > > > In your example to localize the app in English and German, >> you would >> > > > > > > have: >> > >> > > > > > > > res\ >> > > > > > > > values\ >> > > > > > > > strings.xml >> > > > > > > > values-de\ >> > > > > > > > strings.xml >> > >> > > > > > > > And Android will automatically pick up the right strings.xml >> at >> > > > > > > > runtime, depending on the locale. If you want to know more >> about >> > > > > > > > resources and configurations, please readhttp:// >> > > > > > > code.google.com/android/devel/resources-i18n.html >> > >> > > > > > > > On Fri, Jan 23,
[android-developers] Re: Dynamically changing the language at runtime
You will need to do all of the UI recreation in your activity. We don't currently have a way for an activity to ask that it be restarted, sorry. Like I said, this isn't really supported. On Mon, Feb 9, 2009 at 11:29 AM, Mark Nuetzmann wrote: > > I have a settings dialog/activity where I allow the user to change the > locale. Within that activity i call > >Resources res = ctx.getResources(); >// Change locale settings on the device >DisplayMetrics dm = res.getDisplayMetrics(); >android.content.res.Configuration conf = > res.getConfiguration(); >conf.locale = new Locale(language_code.toLowerCase(), > coutry_code.toUpperCase()); >res.updateConfiguration(conf, dm); > > and call onChanged() for my settings ListView... everything changes > perfectly. Very nice. > > Then I hit the back button to go back to the previous activity > thinking everything should be switched; nope. Everything is still in > the previous locale. So I added the above code in the onResume() of > the activity thinking that would do it; nope. Also, when I click the > menu button of this activity again (not first time) I do not get > called in onCreateOptionsMenu() it just displays the previous menu. > > My question is what is the correct way to force existing activities to > reload using the new local? > > thanks. > Mark > > > On Jan 26, 10:39 pm, Raja Nagendra Kumar > wrote: > > Diannel thank you, Deep thank you for the complete source spippet.. > > > > On Jan 27, 1:23 am, "deepdr...@googlemail.com" > > > > wrote: > > > ya, great, thanks, this works for me ! : > > > > > Resources res = getResources(); > > > DisplayMetrics dm = res.getDisplayMetrics(); > > > Configuration conf = res.getConfiguration(); > > > conf.locale = Locale.GERMANY; > > > res.updateConfiguration(conf, dm); > > > firstline= res.getString(R.string.firstline); > > > > > On Jan 26, 9:09 pm, Dianne Hackborn wrote: > > > > > > You can't just modify the structure, you need to give a new > Configuration of > > > > new values to Resources.updateConfiguration(). > > > > > > On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < > > > > > > deepdr...@googlemail.com> wrote: > > > > > > > I tried : > > > > > > >Resources res = getResources(); > > > > >res.getConfiguration().locale = Locale.GERMANY; > > > > >firstline= res.getString(R.string.firstline); > > > > > > > in my onCreate() . But, although I do have > res/values-de/strings.xml > > > > > this still gives me the english string for firstline. > > > > > So it seems to me that there's no easy way to test different > languages > > > > > without an actual device for that language (?) > > > > > > > On Jan 24, 10:28 pm, Dianne Hackborn wrote: > > > > > > This isn't really supported, though you can change the language > of the > > > > > > Configuration used by your Resources object. This will only > impact your > > > > > own > > > > > > app, though, not things displayed by others like your > notifications > > > > > (those > > > > > > will still use the system's locale). > > > > > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < > > > > > > > > nagendra.r...@gmail.com> wrote: > > > > > > > > > Hi Romain, > > > > > > > > > Thank You Romain, a follow up to this how do I change the > default > > > > > > > languge to choose in my application based on the menu we > provide with > > > > > > > in the andorid application.. > > > > > > > I may still want to keep my phone locale some thing deferent > than the > > > > > > > application locale. > > > > > > > > > Regards, > > > > > > > Nagendra > > > > > > > > > On Jan 24, 11:16 am, Romain Guy wrote: > > > > > > > > Hi, > > > > > > > > > > All you need to do is place your resources in locale specific > > > > > > > > directories. For instance: > > > > > > > > > > res\ > > > > > > > > drawable-en\ > > > > > > > > values-fr\ > > > > > > > > layout-jp\ > > > > > > > > > > In your example to localize the app in English and German, > you would > > > > > > > have: > > > > > > > > > > res\ > > > > > > > > values\ > > > > > > > > strings.xml > > > > > > > > values-de\ > > > > > > > > strings.xml > > > > > > > > > > And Android will automatically pick up the right strings.xml > at > > > > > > > > runtime, depending on the locale. If you want to know more > about > > > > > > > > resources and configurations, please readhttp:// > > > > > > > code.google.com/android/devel/resources-i18n.html > > > > > > > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > > > > > wrote: > > > > > > > > > > > Is there any good example to show how a single compiled > application > > > > > > > > > could support both english and say germany.. > > > > > > > > > > > The aapt approach and Resource R.java approach seems to me >
[android-developers] Re: Dynamically changing the language at runtime
I have a settings dialog/activity where I allow the user to change the locale. Within that activity i call Resources res = ctx.getResources(); // Change locale settings on the device DisplayMetrics dm = res.getDisplayMetrics(); android.content.res.Configuration conf = res.getConfiguration(); conf.locale = new Locale(language_code.toLowerCase(), coutry_code.toUpperCase()); res.updateConfiguration(conf, dm); and call onChanged() for my settings ListView... everything changes perfectly. Very nice. Then I hit the back button to go back to the previous activity thinking everything should be switched; nope. Everything is still in the previous locale. So I added the above code in the onResume() of the activity thinking that would do it; nope. Also, when I click the menu button of this activity again (not first time) I do not get called in onCreateOptionsMenu() it just displays the previous menu. My question is what is the correct way to force existing activities to reload using the new local? thanks. Mark On Jan 26, 10:39 pm, Raja Nagendra Kumar wrote: > Diannel thank you, Deep thank you for the complete source spippet.. > > On Jan 27, 1:23 am, "deepdr...@googlemail.com" > > wrote: > > ya, great, thanks, this works for me ! : > > > Resources res = getResources(); > > DisplayMetrics dm = res.getDisplayMetrics(); > > Configuration conf = res.getConfiguration(); > > conf.locale = Locale.GERMANY; > > res.updateConfiguration(conf, dm); > > firstline= res.getString(R.string.firstline); > > > On Jan 26, 9:09 pm, Dianne Hackborn wrote: > > > > You can't just modify the structure, you need to give a new Configuration > > > of > > > new values to Resources.updateConfiguration(). > > > > On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < > > > > deepdr...@googlemail.com> wrote: > > > > > I tried : > > > > > Resources res = getResources(); > > > > res.getConfiguration().locale = Locale.GERMANY; > > > > firstline= res.getString(R.string.firstline); > > > > > in my onCreate() . But, although I do have res/values-de/strings.xml > > > > this still gives me the english string for firstline. > > > > So it seems to me that there's no easy way to test different languages > > > > without an actual device for that language (?) > > > > > On Jan 24, 10:28 pm, Dianne Hackborn wrote: > > > > > This isn't really supported, though you can change the language of the > > > > > Configuration used by your Resources object. This will only impact > > > > > your > > > > own > > > > > app, though, not things displayed by others like your notifications > > > > (those > > > > > will still use the system's locale). > > > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < > > > > > > nagendra.r...@gmail.com> wrote: > > > > > > > Hi Romain, > > > > > > > Thank You Romain, a follow up to this how do I change the default > > > > > > languge to choose in my application based on the menu we provide > > > > > > with > > > > > > in the andorid application.. > > > > > > I may still want to keep my phone locale some thing deferent than > > > > > > the > > > > > > application locale. > > > > > > > Regards, > > > > > > Nagendra > > > > > > > On Jan 24, 11:16 am, Romain Guy wrote: > > > > > > > Hi, > > > > > > > > All you need to do is place your resources in locale specific > > > > > > > directories. For instance: > > > > > > > > res\ > > > > > > > drawable-en\ > > > > > > > values-fr\ > > > > > > > layout-jp\ > > > > > > > > In your example to localize the app in English and German, you > > > > > > > would > > > > > > have: > > > > > > > > res\ > > > > > > > values\ > > > > > > > strings.xml > > > > > > > values-de\ > > > > > > > strings.xml > > > > > > > > And Android will automatically pick up the right strings.xml at > > > > > > > runtime, depending on the locale. If you want to know more about > > > > > > > resources and configurations, please readhttp:// > > > > > > code.google.com/android/devel/resources-i18n.html > > > > > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > > > wrote: > > > > > > > > > Is there any good example to show how a single compiled > > > > > > > > application > > > > > > > > could support both english and say germany.. > > > > > > > > > The aapt approach and Resource R.java approach seems to me > > > > > > > > that, we > > > > > > > > may need to have one binary for english and one for germany > > > > etc..and > > > > > > > > so on.. > > > > > > > > > Like in J2ME, could we switch the language at runtime.. > > > > > > > > > Regards, > > > > > > > > Raja Nagendra Kumar, > > > > > > > > C.T.O > > > > > > > >www.tejasoft.com > > > > > > > > -- > > > > > > > Romain Guy > > > > > > > Android framework engineer > > >
[android-developers] Re: Dynamically changing the language at runtime
Diannel thank you, Deep thank you for the complete source spippet.. On Jan 27, 1:23 am, "deepdr...@googlemail.com" wrote: > ya, great, thanks, this works for me ! : > > Resources res = getResources(); > DisplayMetrics dm = res.getDisplayMetrics(); > Configuration conf = res.getConfiguration(); > conf.locale = Locale.GERMANY; > res.updateConfiguration(conf, dm); > firstline= res.getString(R.string.firstline); > > On Jan 26, 9:09 pm, Dianne Hackborn wrote: > > > > > You can't just modify the structure, you need to give a new Configuration of > > new values to Resources.updateConfiguration(). > > > On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < > > > deepdr...@googlemail.com> wrote: > > > > I tried : > > > > Resources res = getResources(); > > > res.getConfiguration().locale = Locale.GERMANY; > > > firstline= res.getString(R.string.firstline); > > > > in my onCreate() . But, although I do have res/values-de/strings.xml > > > this still gives me the english string for firstline. > > > So it seems to me that there's no easy way to test different languages > > > without an actual device for that language (?) > > > > On Jan 24, 10:28 pm, Dianne Hackborn wrote: > > > > This isn't really supported, though you can change the language of the > > > > Configuration used by your Resources object. This will only impact your > > > own > > > > app, though, not things displayed by others like your notifications > > > (those > > > > will still use the system's locale). > > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < > > > > > nagendra.r...@gmail.com> wrote: > > > > > > Hi Romain, > > > > > > Thank You Romain, a follow up to this how do I change the default > > > > > languge to choose in my application based on the menu we provide with > > > > > in the andorid application.. > > > > > I may still want to keep my phone locale some thing deferent than the > > > > > application locale. > > > > > > Regards, > > > > > Nagendra > > > > > > On Jan 24, 11:16 am, Romain Guy wrote: > > > > > > Hi, > > > > > > > All you need to do is place your resources in locale specific > > > > > > directories. For instance: > > > > > > > res\ > > > > > > drawable-en\ > > > > > > values-fr\ > > > > > > layout-jp\ > > > > > > > In your example to localize the app in English and German, you would > > > > > have: > > > > > > > res\ > > > > > > values\ > > > > > > strings.xml > > > > > > values-de\ > > > > > > strings.xml > > > > > > > And Android will automatically pick up the right strings.xml at > > > > > > runtime, depending on the locale. If you want to know more about > > > > > > resources and configurations, please readhttp:// > > > > > code.google.com/android/devel/resources-i18n.html > > > > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > > wrote: > > > > > > > > Is there any good example to show how a single compiled > > > > > > > application > > > > > > > could support both english and say germany.. > > > > > > > > The aapt approach and Resource R.java approach seems to me that, > > > > > > > we > > > > > > > may need to have one binary for english and one for germany > > > etc..and > > > > > > > so on.. > > > > > > > > Like in J2ME, could we switch the language at runtime.. > > > > > > > > Regards, > > > > > > > Raja Nagendra Kumar, > > > > > > > C.T.O > > > > > > >www.tejasoft.com > > > > > > > -- > > > > > > Romain Guy > > > > > > Android framework engineer > > > > > > romain...@android.com > > > > > > > Note: please don't send private questions to me, as I don't have > > > > > > time > > > > > > to provide private support. All such questions should be posted on > > > > > > public forums, where I and others can see and answer them- Hide > > > quoted > > > > > text - > > > > > > > - Show quoted text - > > > > > -- > > > > Dianne Hackborn > > > > Android framework engineer > > > > hack...@android.com > > > > > Note: please don't send private questions to me, as I don't have time to > > > > provide private support. All such questions should be posted on public > > > > forums, where I and others can see and answer them. > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > Note: please don't send private questions to me, as I don't have time to > > provide private support. All such questions should be posted on public > > forums, where I and others can see and answer them.- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.
[android-developers] Re: Dynamically changing the language at runtime
ya, great, thanks, this works for me ! : Resources res = getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = Locale.GERMANY; res.updateConfiguration(conf, dm); firstline= res.getString(R.string.firstline); On Jan 26, 9:09 pm, Dianne Hackborn wrote: > You can't just modify the structure, you need to give a new Configuration of > new values to Resources.updateConfiguration(). > > On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < > > > > deepdr...@googlemail.com> wrote: > > > I tried : > > > Resources res = getResources(); > > res.getConfiguration().locale = Locale.GERMANY; > > firstline= res.getString(R.string.firstline); > > > in my onCreate() . But, although I do have res/values-de/strings.xml > > this still gives me the english string for firstline. > > So it seems to me that there's no easy way to test different languages > > without an actual device for that language (?) > > > On Jan 24, 10:28 pm, Dianne Hackborn wrote: > > > This isn't really supported, though you can change the language of the > > > Configuration used by your Resources object. This will only impact your > > own > > > app, though, not things displayed by others like your notifications > > (those > > > will still use the system's locale). > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < > > > > nagendra.r...@gmail.com> wrote: > > > > > Hi Romain, > > > > > Thank You Romain, a follow up to this how do I change the default > > > > languge to choose in my application based on the menu we provide with > > > > in the andorid application.. > > > > I may still want to keep my phone locale some thing deferent than the > > > > application locale. > > > > > Regards, > > > > Nagendra > > > > > On Jan 24, 11:16 am, Romain Guy wrote: > > > > > Hi, > > > > > > All you need to do is place your resources in locale specific > > > > > directories. For instance: > > > > > > res\ > > > > > drawable-en\ > > > > > values-fr\ > > > > > layout-jp\ > > > > > > In your example to localize the app in English and German, you would > > > > have: > > > > > > res\ > > > > > values\ > > > > > strings.xml > > > > > values-de\ > > > > > strings.xml > > > > > > And Android will automatically pick up the right strings.xml at > > > > > runtime, depending on the locale. If you want to know more about > > > > > resources and configurations, please readhttp:// > > > > code.google.com/android/devel/resources-i18n.html > > > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > wrote: > > > > > > > Is there any good example to show how a single compiled application > > > > > > could support both english and say germany.. > > > > > > > The aapt approach and Resource R.java approach seems to me that, we > > > > > > may need to have one binary for english and one for germany > > etc..and > > > > > > so on.. > > > > > > > Like in J2ME, could we switch the language at runtime.. > > > > > > > Regards, > > > > > > Raja Nagendra Kumar, > > > > > > C.T.O > > > > > >www.tejasoft.com > > > > > > -- > > > > > Romain Guy > > > > > Android framework engineer > > > > > romain...@android.com > > > > > > Note: please don't send private questions to me, as I don't have time > > > > > to provide private support. All such questions should be posted on > > > > > public forums, where I and others can see and answer them- Hide > > quoted > > > > text - > > > > > > - Show quoted text - > > > > -- > > > Dianne Hackborn > > > Android framework engineer > > > hack...@android.com > > > > Note: please don't send private questions to me, as I don't have time to > > > provide private support. All such questions should be posted on public > > > forums, where I and others can see and answer them. > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support. All such questions should be posted on public > forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dynamically changing the language at runtime
You can't just modify the structure, you need to give a new Configuration of new values to Resources.updateConfiguration(). On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com < deepdr...@googlemail.com> wrote: > > I tried : > >Resources res = getResources(); >res.getConfiguration().locale = Locale.GERMANY; >firstline= res.getString(R.string.firstline); > > in my onCreate() . But, although I do have res/values-de/strings.xml > this still gives me the english string for firstline. > So it seems to me that there's no easy way to test different languages > without an actual device for that language (?) > > > On Jan 24, 10:28 pm, Dianne Hackborn wrote: > > This isn't really supported, though you can change the language of the > > Configuration used by your Resources object. This will only impact your > own > > app, though, not things displayed by others like your notifications > (those > > will still use the system's locale). > > > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < > > > > > > > > nagendra.r...@gmail.com> wrote: > > > > > Hi Romain, > > > > > Thank You Romain, a follow up to this how do I change the default > > > languge to choose in my application based on the menu we provide with > > > in the andorid application.. > > > I may still want to keep my phone locale some thing deferent than the > > > application locale. > > > > > Regards, > > > Nagendra > > > > > On Jan 24, 11:16 am, Romain Guy wrote: > > > > Hi, > > > > > > All you need to do is place your resources in locale specific > > > > directories. For instance: > > > > > > res\ > > > > drawable-en\ > > > > values-fr\ > > > > layout-jp\ > > > > > > In your example to localize the app in English and German, you would > > > have: > > > > > > res\ > > > > values\ > > > > strings.xml > > > > values-de\ > > > > strings.xml > > > > > > And Android will automatically pick up the right strings.xml at > > > > runtime, depending on the locale. If you want to know more about > > > > resources and configurations, please readhttp:// > > > code.google.com/android/devel/resources-i18n.html > > > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > wrote: > > > > > > > Is there any good example to show how a single compiled application > > > > > could support both english and say germany.. > > > > > > > The aapt approach and Resource R.java approach seems to me that, we > > > > > may need to have one binary for english and one for germany > etc..and > > > > > so on.. > > > > > > > Like in J2ME, could we switch the language at runtime.. > > > > > > > Regards, > > > > > Raja Nagendra Kumar, > > > > > C.T.O > > > > >www.tejasoft.com > > > > > > -- > > > > Romain Guy > > > > Android framework engineer > > > > romain...@android.com > > > > > > Note: please don't send private questions to me, as I don't have time > > > > to provide private support. All such questions should be posted on > > > > public forums, where I and others can see and answer them- Hide > quoted > > > text - > > > > > > - Show quoted text - > > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > > Note: please don't send private questions to me, as I don't have time to > > provide private support. All such questions should be posted on public > > forums, where I and others can see and answer them. > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dynamically changing the language at runtime
I tried : Resources res = getResources(); res.getConfiguration().locale = Locale.GERMANY; firstline= res.getString(R.string.firstline); in my onCreate() . But, although I do have res/values-de/strings.xml this still gives me the english string for firstline. So it seems to me that there's no easy way to test different languages without an actual device for that language (?) On Jan 24, 10:28 pm, Dianne Hackborn wrote: > This isn't really supported, though you can change the language of the > Configuration used by your Resources object. This will only impact your own > app, though, not things displayed by others like your notifications (those > will still use the system's locale). > > On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < > > > > nagendra.r...@gmail.com> wrote: > > > Hi Romain, > > > Thank You Romain, a follow up to this how do I change the default > > languge to choose in my application based on the menu we provide with > > in the andorid application.. > > I may still want to keep my phone locale some thing deferent than the > > application locale. > > > Regards, > > Nagendra > > > On Jan 24, 11:16 am, Romain Guy wrote: > > > Hi, > > > > All you need to do is place your resources in locale specific > > > directories. For instance: > > > > res\ > > > drawable-en\ > > > values-fr\ > > > layout-jp\ > > > > In your example to localize the app in English and German, you would > > have: > > > > res\ > > > values\ > > > strings.xml > > > values-de\ > > > strings.xml > > > > And Android will automatically pick up the right strings.xml at > > > runtime, depending on the locale. If you want to know more about > > > resources and configurations, please readhttp:// > > code.google.com/android/devel/resources-i18n.html > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > wrote: > > > > > Is there any good example to show how a single compiled application > > > > could support both english and say germany.. > > > > > The aapt approach and Resource R.java approach seems to me that, we > > > > may need to have one binary for english and one for germany etc..and > > > > so on.. > > > > > Like in J2ME, could we switch the language at runtime.. > > > > > Regards, > > > > Raja Nagendra Kumar, > > > > C.T.O > > > >www.tejasoft.com > > > > -- > > > Romain Guy > > > Android framework engineer > > > romain...@android.com > > > > Note: please don't send private questions to me, as I don't have time > > > to provide private support. All such questions should be posted on > > > public forums, where I and others can see and answer them- Hide quoted > > text - > > > > - Show quoted text - > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support. All such questions should be posted on public > forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dynamically changing the language at runtime
On Jan 25, 2:28 am, Dianne Hackborn wrote: > This isn't really supported, though you can change the language of the > Configuration used by your Resources object. Could you pl. let me know the API to make this change.. Regards, Nagendra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dynamically changing the language at runtime
This isn't really supported, though you can change the language of the Configuration used by your Resources object. This will only impact your own app, though, not things displayed by others like your notifications (those will still use the system's locale). On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar < nagendra.r...@gmail.com> wrote: > > Hi Romain, > > Thank You Romain, a follow up to this how do I change the default > languge to choose in my application based on the menu we provide with > in the andorid application.. > I may still want to keep my phone locale some thing deferent than the > application locale. > > Regards, > Nagendra > > On Jan 24, 11:16 am, Romain Guy wrote: > > Hi, > > > > All you need to do is place your resources in locale specific > > directories. For instance: > > > > res\ > > drawable-en\ > > values-fr\ > > layout-jp\ > > > > In your example to localize the app in English and German, you would > have: > > > > res\ > > values\ > > strings.xml > > values-de\ > > strings.xml > > > > And Android will automatically pick up the right strings.xml at > > runtime, depending on the locale. If you want to know more about > > resources and configurations, please readhttp:// > code.google.com/android/devel/resources-i18n.html > > > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > > > > > > > wrote: > > > > > Is there any good example to show how a single compiled application > > > could support both english and say germany.. > > > > > The aapt approach and Resource R.java approach seems to me that, we > > > may need to have one binary for english and one for germany etc..and > > > so on.. > > > > > Like in J2ME, could we switch the language at runtime.. > > > > > Regards, > > > Raja Nagendra Kumar, > > > C.T.O > > >www.tejasoft.com > > > > -- > > Romain Guy > > Android framework engineer > > romain...@android.com > > > > Note: please don't send private questions to me, as I don't have time > > to provide private support. All such questions should be posted on > > public forums, where I and others can see and answer them- Hide quoted > text - > > > > - Show quoted text - > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dynamically changing the language at runtime
Hi Romain, Thank You Romain, a follow up to this how do I change the default languge to choose in my application based on the menu we provide with in the andorid application.. I may still want to keep my phone locale some thing deferent than the application locale. Regards, Nagendra On Jan 24, 11:16 am, Romain Guy wrote: > Hi, > > All you need to do is place your resources in locale specific > directories. For instance: > > res\ > drawable-en\ > values-fr\ > layout-jp\ > > In your example to localize the app in English and German, you would have: > > res\ > values\ > strings.xml > values-de\ > strings.xml > > And Android will automatically pick up the right strings.xml at > runtime, depending on the locale. If you want to know more about > resources and configurations, please > readhttp://code.google.com/android/devel/resources-i18n.html > > On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar > > > > > > wrote: > > > Is there any good example to show how a single compiled application > > could support both english and say germany.. > > > The aapt approach and Resource R.java approach seems to me that, we > > may need to have one binary for english and one for germany etc..and > > so on.. > > > Like in J2ME, could we switch the language at runtime.. > > > Regards, > > Raja Nagendra Kumar, > > C.T.O > >www.tejasoft.com > > -- > Romain Guy > Android framework engineer > romain...@android.com > > Note: please don't send private questions to me, as I don't have time > to provide private support. All such questions should be posted on > public forums, where I and others can see and answer them- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dynamically changing the language at runtime
Hi, All you need to do is place your resources in locale specific directories. For instance: res\ drawable-en\ values-fr\ layout-jp\ In your example to localize the app in English and German, you would have: res\ values\ strings.xml values-de\ strings.xml And Android will automatically pick up the right strings.xml at runtime, depending on the locale. If you want to know more about resources and configurations, please read http://code.google.com/android/devel/resources-i18n.html On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar wrote: > > Is there any good example to show how a single compiled application > could support both english and say germany.. > > The aapt approach and Resource R.java approach seems to me that, we > may need to have one binary for english and one for germany etc..and > so on.. > > Like in J2ME, could we switch the language at runtime.. > > Regards, > Raja Nagendra Kumar, > C.T.O > www.tejasoft.com > > > -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---