Hi, got a Compose Preview problem. Our default `r...
# compose
r
Hi, got a Compose Preview problem. Our default
res/values/strings.xml
is Polish, with translations in
values-en
,
values-cs
,
values-de
etc. So Polish is the base/fallback language. The thing is Preview in Android Studio renders everything in English by default. Its default locale resolves to en-US, so it picks values-en instead of the base values/. I'm pretty sure this worked correctly (defaulted to the base language) a few Android Studio versions ago. What I've tried so far: • tools:locale="pl" on <resources> in values/strings.xml. Preview still shows English. • res/resources.properties with unqualifiedResLocale=pl-PL. No effect on Preview at all. The only thing that works is setting it per-preview is
@Preview(locale = "pl")
Is there a project or IDE level way to set the default Preview locale so it falls back to the base values/ (Polish), instead of adding locale="pl" to every
@Preview
?
s
I'd just create my own custom preview annotation which has this default built-in, along with whatever else you typically need as a default like both dark and light mode etc
1
r
I'll likely take that approach in the end, but since it requires editing dozens of files in my project, I was hoping to find an alternative. The root cause clearly lies in Android Studio or compose tooling lib, which assumes the default locale is always en-US and forces it.
s
It's a refactor where you'd just do a find and replace everywhere where you used the default preview, so it shouldn't be that bad
d
KDoc says that the
default
folder will be used. If that's not what you're seeing I'd raise a bug.
r
But what does
default
mean here? If the documentation is referring to
res/values
folder without any qualifier, then it clearly doesn't work, and this is probably a bug. I'll try to report it.
🤷 1