Application context resources not localized after a runtime locale change
See original GitHub issuegetString(R.string.main_activity_title) - always returns valid string as expected
applicationContext.getString(R.string.main_activity_title) - returns only initial locale string
Could you provide any information on this issue?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Change app language programmatically in Android
Resources res = context.getResources(); // Change locale settings in the app. DisplayMetrics dm = res.getDisplayMetrics(); android.content.res ...
Read more >How to change the language on Android at runtime and don't ...
After the language change, activity titles are not translated ... We create a special Context which owns a new localized Resources instance.
Read more >Localize your app - Android Developers
When users run your app, the Android system selects which resources to load, based upon the device's locale. To create resources, you place ......
Read more >The All-In-One Guide for Changing App Locale Dynamically in ...
Changing in-App locale is not straight forward in Android as there is no native ... So, we will get the localized string even...
Read more >Globalization and localization in ASP.NET Core
You develop your app with your default language and prepare it for the localization step without first creating a default resource file.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When I have more time, I’ll try to add a listener approach to notify changes to the static classes.
If you’re using Dagger, you could provide Activity context to your
resourcemanager
using custom scopes. That way it can be consumed inViewModel
without leaking the context. However, it is more about the dagger modules/components.Ok, got it 😃 Thanks for response) I assume that It would be cool to add a note about using applicationContext to get resources in README.md to decrease miss understanding or link to this issue)