# compose

Cheryl Bennett

02/24/2022, 10:28 AM
Hi everyone. I'm really struggling with getting the values of stringResource to update after a locale switch. They update if I close the app and then re-open but if I change locale mid app session, it doesn't. The composable screen is built within a fragment as we’re trying to integrate it into an existing app. The screen in question has multiple stringResources so it's not practical to use mutable state for each one. Has anyone experienced something similar and found a working solution? I think I need to trigger a recomposition but I'm not sure how to do that. Apologies if this is the wrong place to ask. This is my first time raising a question here. Thanks in advance.


02/24/2022, 4:08 PM
I believe that the context is not changed when you update the locale, so compose cannot detect it. How do you do this? I never tried this with compose, but in case of activity/fragment appcompat utility to change locale is actually recreate all activities to use new context wrapper
It also probably a problem in your case for views, not only composables
Maybe it's possible without activity recreation if you will call something like activity.resources.updateCobfiguration with new config with changes locale, it should course context update and recomposition