I've created a KMM library with some string resources. I use this library in a native (non-KMM) Android project. Is there a way to access these resources without making the main native project a KMM project?
The KMM lib uses import org.jetbrains.compose.resources.StringResource
c
chrisjenx
08/20/2024, 5:38 PM
AFAIK, no, the compose resources depend on the compose compiler plugin to work.
You would probably have to roll your own.
It's not crazy difficult, mostly just switching between strings based on Locale passed in
chrisjenx
08/20/2024, 5:39 PM
If you look at what they generate thats pretty much what they do, read strings from resource files based on locale, nothing stopping you creating something like
Copy code
class Resources(locale: Locale) {
val hello = when (locale) {
Locale.Spanish -> "Hola"
else -> "Hello"
}