moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

SwiftUI - Autoupdate Text-Object

Open Sinostria opened this issue 3 years ago • 1 comments

I use MokoMVVM and MokoResources in an app built with Compose and SwiftUI. I know that I can change the language of the entire app by setting it like this: StringDesc.localeType = StringDesc.LocaleType.Custom("es")

How do I have to use the String-Resources in a SwiftUI-Text-Object so that it would update the texts in the app automatically?

Currently I use this Swift-Extension: extension ResourcesStringResource { func translate() -> String { return StringHelper().getString(id: self).localized() } }

And I show the text like this: Text(MR.strings().txtMyString.translate())

Any suggestions?

Sinostria avatar Mar 10 '22 06:03 Sinostria

i don't know how to implement this feature :)

Alex009 avatar Apr 29 '22 05:04 Alex009