Reputation: 1473
I have Strings object like;
object Strings {
object English {
cons val EXAMPLE = "example"
}
object German {
cons val EXAMPLE = "beispiel"
}
}
This is how I call strings on screens;
Text(text = Strings.English.EXAMPLE)
How can i change language? Should i call strings from viewmodel or something else?
I dont want to use xml.
Upvotes: 0
Views: 292
Reputation: 50588
(Traditional) Android Resource System should be your go-to approach for internationalization and it's totally valid to use in Jetpack Compose.
Your approach is inefficient and doesn't scale. You should do extremely tedious manual work to check for locales and what not.
Upvotes: 1