Hi there,
I'm currently adding AppIntents to my iOS app, using TypeDisplayRepresentation to identify each entity. I'm following the example provided in the docs for the name and numericFormat strings, and I have an accompanying stringsdict file of the same format as the example.
This works perfectly in the name of the actions, equivalent to Find Books/All Books, but now within my app anywhere the key value is used (in this example, the string "Book"), %#@VARIABLE@ is literally substituted in. I think the issue is I'm not sure how to handle a NSStringLocalizedFormatKey which is just a single word.
Should I be defining the strings differently within my SwiftUI views to fix this, or is there a problem in my stringsdict file? Thank you!
There's a couple things you could try, assuming you're currently defining the key in code as LocalizedStringResource("Book")
.
- Use a separate table for the App Intents strings i.e.
LocalizedStringResource("Book", table: "AppShortcuts")
. This will separate "Book" as defined in your AppShortcuts.strings / AppShortcuts.stringsdict table from the default Localizable.string / Localizable.stringsdict table that's used in the rest of your app. - Use a more unique key identifier with default value in your code i.e.
LocalizedStringResource("Book.variable", defaultValue: "Book")