Re: Fwd: [android-developers] Re: locale change does not affect menu

2010-10-05 Thread Kumar Bibek
All phones would support locales. May be emulators don't but I guess
if devices are not supporting multiple locales, and it is an important
thing for the user, he will not buy that phone or return it.

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 30, 10:27 am, dinesh adwani dinesh.adwa...@gmail.com wrote:
 use
 ..getBaseContext().getResources().getConfiguration().updateFrom(newConfig)

 -- Forwarded message --
 From: dinesh adwani dinesh.adwa...@gmail.com
 Date: Thu, Sep 30, 2010 at 10:54 AM
 Subject: Re: [android-developers] Re: locale change does not affect menu
 To: android-developers@googlegroups.com

 Hi all,

 normally locale change comes under configuration change and if you have
 overrided onConfigurationChanged thenit is called onchanging locale
 since in normal case when we change locale activity destroy and create again
 to change locale at runtime...but if u have kept ur activity as
 singleInstance...it wont  destroy on changing localefor that assign
 string again in onCreateOptionMenu..since it is called only once so
 assign it inside onPrepareOptionsMenu also...
 this code below...
   Localelocale= newLocale(language code here);
                  Locale.setDefault(locale);
                   Configuration config = new Configuration();
                   config.locale=locale;

 getBaseContext().getResources().updateConfiguration(config,
   getResources().getDisplayMetrics());

 is forcing locale to change when you want to change it.

   On Wed, Sep 29, 2010 at 5:52 PM, Adrian Vintu adrianvi...@gmail.comwrote:

  I also added a setLocale in onStart and onConfigurationChanged, but this is
  really getting out of control :(

  BR,

  Adrian Vintu
 http://adrianvintu.com

    On Wed, Sep 29, 2010 at 1:38 PM, Adrian Vintu 
  adrianvi...@gmail.comwrote:

  Hi Engin,

  I also noticed this behaviour - albeit, only in the emulator. I cannot
  test on a 2.2 phone.

  Unfortunately, I did have enough time to find out why this happens, so I
  made a hack.

  First, some info: this resetting of the locale probably happens somewhere
  after the onResume(). This means that not only the menu gets reset to the
  default locale, but also, for example, in onTextChanged if we show a
  validation message, this message will also be displayed in the default
  system locale.

  What I did is identify the key events that can happen in my application
  AFTER the onResume.

  I see that the user will either:
  a. onPrepareOptionsMenu
  or
  b. onTextChanged

  So two events - pretty easy for me.

  I added in those methods something like this:

          if (!hasSetLocaleSpecial)
          {
              setLocale();

              hasSetLocaleSpecial = true;
          }

  Basically, I am calling the setLocale again, in the FIRST event that can
  happen after onResume.

  It is a horrible hack, but until I can get more info on why this happens,
  I will stick to it.

  I hope this will help you a little bit.

  Best Regards,
  Adrian Vintu
 http://adrianvintu.com

  PS another developer asked this question, but until now, no answer
 http://groups.google.com/group/android-developers/browse_thread/threa...

  On Wed, Jul 28, 2010 at 3:24 PM, Engin Arslan 
  enginarsla...@gmail.comwrote:

  Richard,

  no it is not what i am trying to do.
  Suppose that I have an telephone which does not support Germany but i
  want to develop application supporting many languages as well as
  Germany . if the only way of changing language of application is
  changing Locale from telephone settings , it is impossible to .
  To summarize , i only want user to be able to choose my application
  language using application's settings. I partially achieved this using
  site that ı posted link. however, menu does not change when ı apply
  that way

  On Jul 28, 2:57 pm, RichardC richard.crit...@googlemail.com wrote:
   For multi-language apps you don't need to do any of this. Have a read
   of localization in the docs:
 http://developer.android.com/guide/topics/resources/localization.html
   you will get the collect localized resources loaded automatically by
   the platform.

   If however you are trying to switch language/localein a running app,
   then as DH pointed out the platform does not support this.

   I have not looked into the platform code for lanuage/locale(s) but I
   suppect that Android has no concept of an applicaton onlylocaleonly
   systemlocale.  If I am correct then are you trying to change
  thelocalefor the whole system?

   On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:

Hi,

i am not trying to fight with system. i am just trying to publish
application having multilanguage capability. so this should not be
fighting.
 Whatever,
 http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
in this link i have found alternative way of doing this. by this way
all texts changed proposed language, however

Fwd: [android-developers] Re: locale change does not affect menu

2010-10-01 Thread dinesh adwani
use
..getBaseContext().getResources().getConfiguration().updateFrom(newConfig)
-- Forwarded message --
From: dinesh adwani dinesh.adwa...@gmail.com
Date: Thu, Sep 30, 2010 at 10:54 AM
Subject: Re: [android-developers] Re: locale change does not affect menu
To: android-developers@googlegroups.com


Hi all,

normally locale change comes under configuration change and if you have
overrided onConfigurationChanged thenit is called onchanging locale
since in normal case when we change locale activity destroy and create again
to change locale at runtime...but if u have kept ur activity as
singleInstance...it wont  destroy on changing localefor that assign
string again in onCreateOptionMenu..since it is called only once so
assign it inside onPrepareOptionsMenu also...
this code below...
  Localelocale= newLocale(language code here);
 Locale.setDefault(locale);
  Configuration config = new Configuration();
  config.locale=locale;
 
getBaseContext().getResources().updateConfiguration(config,
  getResources().getDisplayMetrics());

is forcing locale to change when you want to change it.

  On Wed, Sep 29, 2010 at 5:52 PM, Adrian Vintu adrianvi...@gmail.comwrote:

 I also added a setLocale in onStart and onConfigurationChanged, but this is
 really getting out of control :(

 BR,

 Adrian Vintu
 http://adrianvintu.com


   On Wed, Sep 29, 2010 at 1:38 PM, Adrian Vintu adrianvi...@gmail.comwrote:

 Hi Engin,

 I also noticed this behaviour - albeit, only in the emulator. I cannot
 test on a 2.2 phone.

 Unfortunately, I did have enough time to find out why this happens, so I
 made a hack.

 First, some info: this resetting of the locale probably happens somewhere
 after the onResume(). This means that not only the menu gets reset to the
 default locale, but also, for example, in onTextChanged if we show a
 validation message, this message will also be displayed in the default
 system locale.

 What I did is identify the key events that can happen in my application
 AFTER the onResume.

 I see that the user will either:
 a. onPrepareOptionsMenu
 or
 b. onTextChanged

 So two events - pretty easy for me.

 I added in those methods something like this:

 if (!hasSetLocaleSpecial)
 {
 setLocale();

 hasSetLocaleSpecial = true;
 }

 Basically, I am calling the setLocale again, in the FIRST event that can
 happen after onResume.

 It is a horrible hack, but until I can get more info on why this happens,
 I will stick to it.

 I hope this will help you a little bit.

 Best Regards,
 Adrian Vintu
 http://adrianvintu.com

 PS another developer asked this question, but until now, no answer
 http://groups.google.com/group/android-developers/browse_thread/thread/3c9b74cb8eb555e9/7ead8fd7ada84233?hl=en




 On Wed, Jul 28, 2010 at 3:24 PM, Engin Arslan enginarsla...@gmail.comwrote:

 Richard,

 no it is not what i am trying to do.
 Suppose that I have an telephone which does not support Germany but i
 want to develop application supporting many languages as well as
 Germany . if the only way of changing language of application is
 changing Locale from telephone settings , it is impossible to .
 To summarize , i only want user to be able to choose my application
 language using application's settings. I partially achieved this using
 site that ı posted link. however, menu does not change when ı apply
 that way

 On Jul 28, 2:57 pm, RichardC richard.crit...@googlemail.com wrote:
  For multi-language apps you don't need to do any of this. Have a read
  of localization in the docs:
 http://developer.android.com/guide/topics/resources/localization.html
  you will get the collect localized resources loaded automatically by
  the platform.
 
  If however you are trying to switch language/localein a running app,
  then as DH pointed out the platform does not support this.
 
  I have not looked into the platform code for lanuage/locale(s) but I
  suppect that Android has no concept of an applicaton onlylocaleonly
  systemlocale.  If I am correct then are you trying to change
 thelocalefor the whole system?
  
  On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
 
 
   Hi,
 
   i am not trying to fight with system. i am just trying to publish
   application having multilanguage capability. so this should not be
   fighting.
Whatever,
 http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
   in this link i have found alternative way of doing this. by this way
   all texts changed proposed language, however there is still problem
 in
   Menu even if i recreatemenuafter changinglocale.
 
   On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:
 
You have already asked this and got a - don't do this - reply from
Dianne Hackborn.
 
DH  You are blowing away the current configuration in the
 resources
with your
own you have created

Re: [android-developers] Re: locale change does not affect menu

2010-10-01 Thread dinesh adwani
Hi all,

normally locale change comes under configuration change and if you have
overrided onConfigurationChanged thenit is called onchanging locale
since in normal case when we change locale activity destroy and create again
to change locale at runtime...but if u have kept ur activity as
singleInstance...it wont  destroy on changing localefor that assign
string again in onCreateOptionMenu..since it is called only once so
assign it inside onPrepareOptionsMenu also...
this code below...
 Localelocale= newLocale(language code here);
 Locale.setDefault(locale);
  Configuration config = new Configuration();
  config.locale=locale;
 
getBaseContext().getResources().updateConfiguration(config,
  getResources().getDisplayMetrics());

is forcing locale to change when you want to change it.

On Wed, Sep 29, 2010 at 5:52 PM, Adrian Vintu adrianvi...@gmail.com wrote:

 I also added a setLocale in onStart and onConfigurationChanged, but this is
 really getting out of control :(

 BR,

 Adrian Vintu
 http://adrianvintu.com


   On Wed, Sep 29, 2010 at 1:38 PM, Adrian Vintu adrianvi...@gmail.comwrote:

 Hi Engin,

 I also noticed this behaviour - albeit, only in the emulator. I cannot
 test on a 2.2 phone.

 Unfortunately, I did have enough time to find out why this happens, so I
 made a hack.

 First, some info: this resetting of the locale probably happens somewhere
 after the onResume(). This means that not only the menu gets reset to the
 default locale, but also, for example, in onTextChanged if we show a
 validation message, this message will also be displayed in the default
 system locale.

 What I did is identify the key events that can happen in my application
 AFTER the onResume.

 I see that the user will either:
 a. onPrepareOptionsMenu
 or
 b. onTextChanged

 So two events - pretty easy for me.

 I added in those methods something like this:

 if (!hasSetLocaleSpecial)
 {
 setLocale();

 hasSetLocaleSpecial = true;
 }

 Basically, I am calling the setLocale again, in the FIRST event that can
 happen after onResume.

 It is a horrible hack, but until I can get more info on why this happens,
 I will stick to it.

 I hope this will help you a little bit.

 Best Regards,
 Adrian Vintu
 http://adrianvintu.com

 PS another developer asked this question, but until now, no answer
 http://groups.google.com/group/android-developers/browse_thread/thread/3c9b74cb8eb555e9/7ead8fd7ada84233?hl=en




 On Wed, Jul 28, 2010 at 3:24 PM, Engin Arslan enginarsla...@gmail.comwrote:

 Richard,

 no it is not what i am trying to do.
 Suppose that I have an telephone which does not support Germany but i
 want to develop application supporting many languages as well as
 Germany . if the only way of changing language of application is
 changing Locale from telephone settings , it is impossible to .
 To summarize , i only want user to be able to choose my application
 language using application's settings. I partially achieved this using
 site that ı posted link. however, menu does not change when ı apply
 that way

 On Jul 28, 2:57 pm, RichardC richard.crit...@googlemail.com wrote:
  For multi-language apps you don't need to do any of this. Have a read
  of localization in the docs:
 http://developer.android.com/guide/topics/resources/localization.html
  you will get the collect localized resources loaded automatically by
  the platform.
 
  If however you are trying to switch language/localein a running app,
  then as DH pointed out the platform does not support this.
 
  I have not looked into the platform code for lanuage/locale(s) but I
  suppect that Android has no concept of an applicaton onlylocaleonly
  systemlocale.  If I am correct then are you trying to change
 thelocalefor the whole system?
  
  On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
 
 
   Hi,
 
   i am not trying to fight with system. i am just trying to publish
   application having multilanguage capability. so this should not be
   fighting.
Whatever,
 http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
   in this link i have found alternative way of doing this. by this way
   all texts changed proposed language, however there is still problem
 in
   Menu even if i recreatemenuafter changinglocale.
 
   On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:
 
You have already asked this and got a - don't do this - reply from
Dianne Hackborn.
 
DH  You are blowing away the current configuration in the
 resources
with your
own you have created that is not initialized.  Things aren't going
 to
work
when you do that.
 
You could improve that by giving it a properly created
 Configuration,
but I
don't want to help with doing that because what you are trying to
 do
is
never going to work quite right because you will be fighting with

Re: [android-developers] Re: locale change does not affect menu

2010-09-29 Thread Adrian Vintu
Hi Engin,

I also noticed this behaviour - albeit, only in the emulator. I cannot test
on a 2.2 phone.

Unfortunately, I did have enough time to find out why this happens, so I
made a hack.

First, some info: this resetting of the locale probably happens somewhere
after the onResume(). This means that not only the menu gets reset to the
default locale, but also, for example, in onTextChanged if we show a
validation message, this message will also be displayed in the default
system locale.

What I did is identify the key events that can happen in my application
AFTER the onResume.

I see that the user will either:
a. onPrepareOptionsMenu
or
b. onTextChanged

So two events - pretty easy for me.

I added in those methods something like this:

if (!hasSetLocaleSpecial)
{
setLocale();

hasSetLocaleSpecial = true;
}

Basically, I am calling the setLocale again, in the FIRST event that can
happen after onResume.

It is a horrible hack, but until I can get more info on why this happens, I
will stick to it.

I hope this will help you a little bit.

Best Regards,
Adrian Vintu
http://adrianvintu.com

PS another developer asked this question, but until now, no answer
http://groups.google.com/group/android-developers/browse_thread/thread/3c9b74cb8eb555e9/7ead8fd7ada84233?hl=en



On Wed, Jul 28, 2010 at 3:24 PM, Engin Arslan enginarsla...@gmail.comwrote:

 Richard,

 no it is not what i am trying to do.
 Suppose that I have an telephone which does not support Germany but i
 want to develop application supporting many languages as well as
 Germany . if the only way of changing language of application is
 changing Locale from telephone settings , it is impossible to .
 To summarize , i only want user to be able to choose my application
 language using application's settings. I partially achieved this using
 site that ı posted link. however, menu does not change when ı apply
 that way

 On Jul 28, 2:57 pm, RichardC richard.crit...@googlemail.com wrote:
  For multi-language apps you don't need to do any of this. Have a read
  of localization in the docs:
 http://developer.android.com/guide/topics/resources/localization.html
  you will get the collect localized resources loaded automatically by
  the platform.
 
  If however you are trying to switch language/localein a running app,
  then as DH pointed out the platform does not support this.
 
  I have not looked into the platform code for lanuage/locale(s) but I
  suppect that Android has no concept of an applicaton onlylocaleonly
  systemlocale.  If I am correct then are you trying to change thelocalefor
 the whole system?
 
  On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
 
 
   Hi,
 
   i am not trying to fight with system. i am just trying to publish
   application having multilanguage capability. so this should not be
   fighting.
Whatever,
 http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
   in this link i have found alternative way of doing this. by this way
   all texts changed proposed language, however there is still problem in
   Menu even if i recreatemenuafter changinglocale.
 
   On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:
 
You have already asked this and got a - don't do this - reply from
Dianne Hackborn.
 
DH  You are blowing away the current configuration in the resources
with your
own you have created that is not initialized.  Things aren't going to
work
when you do that.
 
You could improve that by giving it a properly created Configuration,
but I
don't want to help with doing that because what you are trying to do
is
never going to work quite right because you will be fighting with the
platform over what configuration is being used in the resources. 
 
See your previous thread:
 http://groups.google.com/group/android-developers/browse_thread/threa...
 
On Jul 27, 1:42 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
 any ideas?
 
 On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
  Specifically,menulanguage changes to English (which is default
  language) when I try to changelocale. And then it does not change
 any
  other language
 
  On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com
 wrote:
 
   Hi all,
 
   I am developing application in which user can choose
 application
   language. To achieve this, I am changing Locale as follows:
  Localelocale= newLocale(language code here);
  Locale.setDefault(locale);
   Configuration config = new Configuration();
   config.locale=locale;
  
 getBaseContext().getResources().updateConfiguration(config,
   getResources().getDisplayMetrics());
   and restart activity in following way:
 
  
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  
 

Re: [android-developers] Re: locale change does not affect menu

2010-09-29 Thread Adrian Vintu
I also added a setLocale in onStart and onConfigurationChanged, but this is
really getting out of control :(

BR,
Adrian Vintu
http://adrianvintu.com


On Wed, Sep 29, 2010 at 1:38 PM, Adrian Vintu adrianvi...@gmail.com wrote:

 Hi Engin,

 I also noticed this behaviour - albeit, only in the emulator. I cannot test
 on a 2.2 phone.

 Unfortunately, I did have enough time to find out why this happens, so I
 made a hack.

 First, some info: this resetting of the locale probably happens somewhere
 after the onResume(). This means that not only the menu gets reset to the
 default locale, but also, for example, in onTextChanged if we show a
 validation message, this message will also be displayed in the default
 system locale.

 What I did is identify the key events that can happen in my application
 AFTER the onResume.

 I see that the user will either:
 a. onPrepareOptionsMenu
 or
 b. onTextChanged

 So two events - pretty easy for me.

 I added in those methods something like this:

 if (!hasSetLocaleSpecial)
 {
 setLocale();

 hasSetLocaleSpecial = true;
 }

 Basically, I am calling the setLocale again, in the FIRST event that can
 happen after onResume.

 It is a horrible hack, but until I can get more info on why this happens, I
 will stick to it.

 I hope this will help you a little bit.

 Best Regards,
 Adrian Vintu
 http://adrianvintu.com

 PS another developer asked this question, but until now, no answer
 http://groups.google.com/group/android-developers/browse_thread/thread/3c9b74cb8eb555e9/7ead8fd7ada84233?hl=en




 On Wed, Jul 28, 2010 at 3:24 PM, Engin Arslan enginarsla...@gmail.comwrote:

 Richard,

 no it is not what i am trying to do.
 Suppose that I have an telephone which does not support Germany but i
 want to develop application supporting many languages as well as
 Germany . if the only way of changing language of application is
 changing Locale from telephone settings , it is impossible to .
 To summarize , i only want user to be able to choose my application
 language using application's settings. I partially achieved this using
 site that ı posted link. however, menu does not change when ı apply
 that way

 On Jul 28, 2:57 pm, RichardC richard.crit...@googlemail.com wrote:
  For multi-language apps you don't need to do any of this. Have a read
  of localization in the docs:
 http://developer.android.com/guide/topics/resources/localization.html
  you will get the collect localized resources loaded automatically by
  the platform.
 
  If however you are trying to switch language/localein a running app,
  then as DH pointed out the platform does not support this.
 
  I have not looked into the platform code for lanuage/locale(s) but I
  suppect that Android has no concept of an applicaton onlylocaleonly
  systemlocale.  If I am correct then are you trying to change
 thelocalefor the whole system?
 
  On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
 
 
   Hi,
 
   i am not trying to fight with system. i am just trying to publish
   application having multilanguage capability. so this should not be
   fighting.
Whatever,
 http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
   in this link i have found alternative way of doing this. by this way
   all texts changed proposed language, however there is still problem in
   Menu even if i recreatemenuafter changinglocale.
 
   On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:
 
You have already asked this and got a - don't do this - reply from
Dianne Hackborn.
 
DH  You are blowing away the current configuration in the
 resources
with your
own you have created that is not initialized.  Things aren't going
 to
work
when you do that.
 
You could improve that by giving it a properly created
 Configuration,
but I
don't want to help with doing that because what you are trying to do
is
never going to work quite right because you will be fighting with
 the
platform over what configuration is being used in the resources. 
 
See your previous thread:
 http://groups.google.com/group/android-developers/browse_thread/threa...
 
On Jul 27, 1:42 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
 any ideas?
 
 On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:
 
  Specifically,menulanguage changes to English (which is default
  language) when I try to changelocale. And then it does not
 change any
  other language
 
  On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com
 wrote:
 
   Hi all,
 
   I am developing application in which user can choose
 application
   language. To achieve this, I am changing Locale as follows:
  Localelocale= newLocale(language code here);
  Locale.setDefault(locale);
   Configuration config = new Configuration();
   config.locale=locale;

[android-developers] Re: locale change does not affect menu

2010-07-28 Thread Engin Arslan
Hi,

i am not trying to fight with system. i am just trying to publish
application having multilanguage capability. so this should not be
fighting.
 Whatever,  http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
in this link i have found alternative way of doing this. by this way
all texts changed proposed language, however there is still problem in
Menu even if i recreate menu after changing locale.

On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:
 You have already asked this and got a - don't do this - reply from
 Dianne Hackborn.

 DH  You are blowing away the current configuration in the resources
 with your
 own you have created that is not initialized.  Things aren't going to
 work
 when you do that.

 You could improve that by giving it a properly created Configuration,
 but I
 don't want to help with doing that because what you are trying to do
 is
 never going to work quite right because you will be fighting with the
 platform over what configuration is being used in the resources. 

 See your previous 
 thread:http://groups.google.com/group/android-developers/browse_thread/threa...

 On Jul 27, 1:42 pm, Engin Arslan enginarsla...@gmail.com wrote:



  any ideas?

  On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:

   Specifically,menulanguage changes to English (which is default
   language) when I try to changelocale. And then it does not change any
   other language

   On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com wrote:

Hi all,

I am developing application in which user can choose application
language. To achieve this, I am changing Locale as follows:
               Localelocale= newLocale(language code here);
               Locale.setDefault(locale);
                Configuration config = new Configuration();
                config.locale=locale;
                
getBaseContext().getResources().updateConfiguration(config,
getResources().getDisplayMetrics());
and restart activity in following way:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                                        
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
. This helps to change languagein runtime.
However , optionmenulanguage does not change , in factmenuchanges
if I close app completely and start again but does not change in
runtime. I even  have tried onPrepareOptionsMenu but it did not work?

What is the reason of this? or can you suggest me another possible
way?

Bests,

-- 
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: locale change does not affect menu

2010-07-28 Thread RichardC
For multi-language apps you don't need to do any of this. Have a read
of localization in the docs:
http://developer.android.com/guide/topics/resources/localization.html
you will get the collect localized resources loaded automatically by
the platform.

If however you are trying to switch language/locale in a running app,
then as DH pointed out the platform does not support this.

I have not looked into the platform code for lanuage/locale(s) but I
suppect that Android has no concept of an applicaton only locale only
system locale.  If I am correct then are you trying to change the
locale for the whole system?


On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:
 Hi,

 i am not trying to fight with system. i am just trying to publish
 application having multilanguage capability. so this should not be
 fighting.
  Whatever,  
 http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
 in this link i have found alternative way of doing this. by this way
 all texts changed proposed language, however there is still problem in
 Menu even if i recreate menu after changing locale.

 On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:

  You have already asked this and got a - don't do this - reply from
  Dianne Hackborn.

  DH  You are blowing away the current configuration in the resources
  with your
  own you have created that is not initialized.  Things aren't going to
  work
  when you do that.

  You could improve that by giving it a properly created Configuration,
  but I
  don't want to help with doing that because what you are trying to do
  is
  never going to work quite right because you will be fighting with the
  platform over what configuration is being used in the resources. 

  See your previous 
  thread:http://groups.google.com/group/android-developers/browse_thread/threa...

  On Jul 27, 1:42 pm, Engin Arslan enginarsla...@gmail.com wrote:

   any ideas?

   On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:

Specifically,menulanguage changes to English (which is default
language) when I try to changelocale. And then it does not change any
other language

On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com wrote:

 Hi all,

 I am developing application in which user can choose application
 language. To achieve this, I am changing Locale as follows:
                Localelocale= newLocale(language code here);
                Locale.setDefault(locale);
                 Configuration config = new Configuration();
                 config.locale=locale;
                 
 getBaseContext().getResources().updateConfiguration(config,
 getResources().getDisplayMetrics());
 and restart activity in following way:

 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                                         
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
 . This helps to change languagein runtime.
 However , optionmenulanguage does not change , in factmenuchanges
 if I close app completely and start again but does not change in
 runtime. I even  have tried onPrepareOptionsMenu but it did not work?

 What is the reason of this? or can you suggest me another possible
 way?

 Bests,

-- 
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: locale change does not affect menu

2010-07-28 Thread Engin Arslan
Richard,

no it is not what i am trying to do.
Suppose that I have an telephone which does not support Germany but i
want to develop application supporting many languages as well as
Germany . if the only way of changing language of application is
changing Locale from telephone settings , it is impossible to .
To summarize , i only want user to be able to choose my application
language using application's settings. I partially achieved this using
site that ı posted link. however, menu does not change when ı apply
that way

On Jul 28, 2:57 pm, RichardC richard.crit...@googlemail.com wrote:
 For multi-language apps you don't need to do any of this. Have a read
 of localization in the 
 docs:http://developer.android.com/guide/topics/resources/localization.html
 you will get the collect localized resources loaded automatically by
 the platform.

 If however you are trying to switch language/localein a running app,
 then as DH pointed out the platform does not support this.

 I have not looked into the platform code for lanuage/locale(s) but I
 suppect that Android has no concept of an applicaton onlylocaleonly
 systemlocale.  If I am correct then are you trying to change thelocalefor the 
 whole system?

 On Jul 28, 12:41 pm, Engin Arslan enginarsla...@gmail.com wrote:



  Hi,

  i am not trying to fight with system. i am just trying to publish
  application having multilanguage capability. so this should not be
  fighting.
   Whatever,  
  http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
  in this link i have found alternative way of doing this. by this way
  all texts changed proposed language, however there is still problem in
  Menu even if i recreatemenuafter changinglocale.

  On Jul 27, 5:00 pm, RichardC richard.crit...@googlemail.com wrote:

   You have already asked this and got a - don't do this - reply from
   Dianne Hackborn.

   DH  You are blowing away the current configuration in the resources
   with your
   own you have created that is not initialized.  Things aren't going to
   work
   when you do that.

   You could improve that by giving it a properly created Configuration,
   but I
   don't want to help with doing that because what you are trying to do
   is
   never going to work quite right because you will be fighting with the
   platform over what configuration is being used in the resources. 

   See your previous 
   thread:http://groups.google.com/group/android-developers/browse_thread/threa...

   On Jul 27, 1:42 pm, Engin Arslan enginarsla...@gmail.com wrote:

any ideas?

On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:

 Specifically,menulanguage changes to English (which is default
 language) when I try to changelocale. And then it does not change any
 other language

 On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com wrote:

  Hi all,

  I am developing application in which user can choose application
  language. To achieve this, I am changing Locale as follows:
                 Localelocale= newLocale(language code here);
                 Locale.setDefault(locale);
                  Configuration config = new Configuration();
                  config.locale=locale;
                  
  getBaseContext().getResources().updateConfiguration(config,
  getResources().getDisplayMetrics());
  and restart activity in following way:

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                                          
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
  . This helps to change languagein runtime.
  However , optionmenulanguage does not change , in factmenuchanges
  if I close app completely and start again but does not change in
  runtime. I even  have tried onPrepareOptionsMenu but it did not 
  work?

  What is the reason of this? or can you suggest me another possible
  way?

  Bests,

-- 
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: locale change does not affect menu

2010-07-27 Thread Engin Arslan
any ideas?

On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:
 Specifically,menulanguage changes to English (which is default
 language) when I try to changelocale. And then it does not change any
 other language

 On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com wrote:



  Hi all,

  I am developing application in which user can choose application
  language. To achieve this, I am changing Locale as follows:
                 Localelocale= newLocale(language code here);
                 Locale.setDefault(locale);
                  Configuration config = new Configuration();
                  config.locale=locale;
                  getBaseContext().getResources().updateConfiguration(config,
  getResources().getDisplayMetrics());
  and restart activity in following way:

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                                          
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
  . This helps to change languagein runtime.
  However , optionmenulanguage does not change , in factmenuchanges
  if I close app completely and start again but does not change in
  runtime. I even  have tried onPrepareOptionsMenu but it did not work?

  What is the reason of this? or can you suggest me another possible
  way?

  Bests,

-- 
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: locale change does not affect menu

2010-07-27 Thread RichardC
You have already asked this and got a - don't do this - reply from
Dianne Hackborn.

DH  You are blowing away the current configuration in the resources
with your
own you have created that is not initialized.  Things aren't going to
work
when you do that.

You could improve that by giving it a properly created Configuration,
but I
don't want to help with doing that because what you are trying to do
is
never going to work quite right because you will be fighting with the
platform over what configuration is being used in the resources. 


See your previous thread:
http://groups.google.com/group/android-developers/browse_thread/thread/ad03d76b80dc2c11


On Jul 27, 1:42 pm, Engin Arslan enginarsla...@gmail.com wrote:
 any ideas?

 On Jul 23, 3:17 pm, Engin Arslan enginarsla...@gmail.com wrote:

  Specifically,menulanguage changes to English (which is default
  language) when I try to changelocale. And then it does not change any
  other language

  On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com wrote:

   Hi all,

   I am developing application in which user can choose application
   language. To achieve this, I am changing Locale as follows:
                  Localelocale= newLocale(language code here);
                  Locale.setDefault(locale);
                   Configuration config = new Configuration();
                   config.locale=locale;
                   
   getBaseContext().getResources().updateConfiguration(config,
   getResources().getDisplayMetrics());
   and restart activity in following way:

   setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                                           
   setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
   . This helps to change languagein runtime.
   However , optionmenulanguage does not change , in factmenuchanges
   if I close app completely and start again but does not change in
   runtime. I even  have tried onPrepareOptionsMenu but it did not work?

   What is the reason of this? or can you suggest me another possible
   way?

   Bests,

-- 
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: locale change does not affect menu

2010-07-23 Thread Engin Arslan
Specifically, menu language changes to English (which is default
language) when I try to change locale. And then it does not change any
other language

On Jul 23, 2:18 pm, Engin Arslan enginarsla...@gmail.com wrote:
 Hi all,

 I am developing application in which user can choose application
 language. To achieve this, I am changing Locale as follows:
                Localelocale= newLocale(language code here);
                Locale.setDefault(locale);
                 Configuration config = new Configuration();
                 config.locale=locale;
                 getBaseContext().getResources().updateConfiguration(config,
 getResources().getDisplayMetrics());
 and restart activity in following way:

 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                                         
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
 . This helps to change languagein runtime.
 However , optionmenulanguage does not change , in factmenuchanges
 if I close app completely and start again but does not change in
 runtime. I even  have tried onPrepareOptionsMenu but it did not work?

 What is the reason of this? or can you suggest me another possible
 way?

 Bests,

-- 
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