WAI
Status Update
Comments
ro...@google.com <ro...@google.com> #2
Sorry, this tracker is for issues with the Android OS only. Please use https://support.google.com/ to obtain support for Google products or services.
as...@gmail.com <as...@gmail.com> #3
I've searched for correct issue tracker for 15 minutes and wasn't able to find one. The link you gave doesn't help too.
Even Googlers on your support forum don't know where is the issue tracker for Google Play Serviceshttps://productforums.google.com/forum/#!topic/play/dZBSTcEuboA;context-place=topicsearchin/play/google$20play$20services$20issue$20tracker .
Please reopen this issue here or in the right place because basically it's going to /dev/null now.
Even Googlers on your support forum don't know where is the issue tracker for Google Play Services
Please reopen this issue here or in the right place because basically it's going to /dev/null now.
[Deleted User] <[Deleted User]> #4
Sorry, there doesn't seem to be an appropriate place to report bugs with Play Services. But they aren't part of AOSP Android so there's literally no point raising it here - we can't provide help or support for something we don't have the source of.
as...@gmail.com <as...@gmail.com> #6
Thanks david, i will test that solution.
[Deleted User] <[Deleted User]> #7
Well my solution with ContextWrapper is rly bugged. http://stackoverflow.com/questions/39705739/android-n-change-language-programatically/40849142#40849142
I can't rly understand whats going on. Sometimes in one activity different strings can be in english and in other locale at the same time. Sometimes after screen rotation and activity recreation locale returns to device default.
Can some1 give me a good example of how to change app locale programatically? Or how to use this API:https://developer.android.com/reference/android/content/Context.html#createConfigurationContext(android.content.res.Configuration) .
I can't rly understand whats going on. Sometimes in one activity different strings can be in english and in other locale at the same time. Sometimes after screen rotation and activity recreation locale returns to device default.
Can some1 give me a good example of how to change app locale programatically? Or how to use this API:
ad...@google.com <ad...@google.com> #8
When you use Context#createConfigurationContext(), the configuration will only apply to resources inflated from that context.
In order to apply an override for your entire Activity, you should usehttps://developer.android.com/reference/android/view/ContextThemeWrapper.html#applyOverrideConfiguration(android.content.res.Configuration) .
In order to apply an override for your entire Activity, you should use
ya...@gmail.com <ya...@gmail.com> #9
Hello everyone :)
So I have created some helper class that will do something very similar to David's solution.
For me all works well in one exception : in our app we have our custom Application class available as a Singleton, and we sometimes use it to retrieve resources like strings. So let's assume a moment I'm not using deprecated methods anymore (like Resources.updateConfiguration()), my ApplicationContext is never updated with the proper language (thus is always configured with default settings).
I couldn't find a way to applyOverrideConfiguration to the Application instance, like we can do with the Activity instance... And even though I understand it is probably not a good practice to use the ApplicationContext as a static singleton, but in this case it would be quite some work to change that pattern.
Any way we can update the application (even at startup) with the proper language ?
Thanks in advance.
Cheers,
Yannick
So I have created some helper class that will do something very similar to David's solution.
For me all works well in one exception : in our app we have our custom Application class available as a Singleton, and we sometimes use it to retrieve resources like strings. So let's assume a moment I'm not using deprecated methods anymore (like Resources.updateConfiguration()), my ApplicationContext is never updated with the proper language (thus is always configured with default settings).
I couldn't find a way to applyOverrideConfiguration to the Application instance, like we can do with the Activity instance... And even though I understand it is probably not a good practice to use the ApplicationContext as a static singleton, but in this case it would be quite some work to change that pattern.
Any way we can update the application (even at startup) with the proper language ?
Thanks in advance.
Cheers,
Yannick
er...@gmail.com <er...@gmail.com> #10
[Comment deleted]
er...@gmail.com <er...@gmail.com> #11
After hours of desperation I finally managed to set the locale at runtime and starting the app by using SharedPreference which holds the locale and writing my own ContextWrapper thanks @david!
I'd love to see some official guides from google for some common use cases since switching the locale is a crutial requirement in nearly every app today.
I'd love to see some official guides from google for some common use cases since switching the locale is a crutial requirement in nearly every app today.
zx...@gmail.com <zx...@gmail.com> #12
the solution A or B that use contextWraper or use applyOverideConfirguraton to change the configuration of the current resource,are about ok .but it still cause one problem.
The Bug Example Like this:our app have more languages setting,that contain en,ru,es et.when we follow this step, en->ru,ru->en repeatedly,when user switch to ru ,but the activity also show en language after oncreate expect we restart the app.
follow #11 ,I'd love to see some official guides from google for some common use cases since switching the locale
The Bug Example Like this:our app have more languages setting,that contain en,ru,es et.when we follow this step, en->ru,ru->en repeatedly,when user switch to ru ,but the activity also show en language after oncreate expect we restart the app.
follow #11 ,I'd love to see some official guides from google for some common use cases since switching the locale
ha...@gmail.com <ha...@gmail.com> #13
I am getting an issue in android 7.0 only its working on higher as well as low version devices. My application is taking the default device language instead of app language.
li...@gmail.com <li...@gmail.com> #14
I can also report that after switching targetSDK to 29, I now get this issue on Android 7 devices only. For me, changing my approach to the solution provided here: https://stackoverflow.com/a/58155189/5007
was the only way I could reliably change the locale for all my resources, no matter which version of Android we are targetting.
was the only way I could reliably change the locale for all my resources, no matter which version of Android we are targetting.
ri...@gmail.com <ri...@gmail.com> #15
I faced this issue when i started to target SDK 29. The LocaleHelper that i created worked on every version from my min SDK(21) to 29 but specifically on Android N it didn't use to work. So after viewing this issue and many stack overflow answers, i managed to find/modify a solution which is now working on all android versions.
Earlier it didn't work on redmi 4a(Android 7) and emulator of 24.
I tested on emulators of 21, 24, 28 and 29. Devices like redmi 4a(Android 7), redmi note 5 pro (Android 9 and 10) and pixel 2.
In app language selection worked on all.
You can find it here:https://stackoverflow.com/questions/38997356/change-language-programmatically-android-n-7-0-api-24/61476201#61476201
Earlier it didn't work on redmi 4a(Android 7) and emulator of 24.
I tested on emulators of 21, 24, 28 and 29. Devices like redmi 4a(Android 7), redmi note 5 pro (Android 9 and 10) and pixel 2.
In app language selection worked on all.
You can find it here:
Description
We are relying on changing the locale programatically as following:
Locale locale = new Locale("ru");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
this way works fine on all Android versions except on Android 7.
the system changes app's locale to the default locale suddenly.
please have a look here :