Open zacharee opened 4 months ago
hi. moko-resources not write strings into main bundle. it write strings and other resources to self bundle inside framework.
as i see LocalizedStringResource
works on bundle base, so you can create LocalizedStringResource
instance with data from moko's StringResource
https://developer.apple.com/documentation/foundation/localizedstringresource/3988421-init
https://github.com/icerockdev/moko-resources/blob/71095fc691d8769b581b1b48c489701f0fd2c344/resources/src/appleMain/kotlin/dev/icerock/moko/resources/StringResource.kt
let str: StringResource
LocalizedStringResource(
String.LocalizationValue(str.resourceId),
bundle: LocalizedStringResource.BundleDescription.atURL(str.bundle.bundleURL)
)
i think it should work
I tried that too. It doesn't let you use that initializer for this.
I've been looking into adding Shortcuts integration to my app on iOS. The Apple documentation shows an example for AppIntent here:
You're then supposed to add that struct to an
AppShortcutsProvider
implementation: https://developer.apple.com/documentation/appintents/appshortcutsprovider.The problem I'm running into is that
LocalizedStringResource
is something that can only handle compile-time values, which means I can't useMR.strings().someString.desc().localized()
. I did try passing the generated keysomeString
, but it doesn't seem like the framework knows to look in non-main resource bundles.Is there a way for moko resources to write its strings to the main resource bundle, or a way I can tell my iOS app to search other bundles when looking for localization keys?