Tim*_*imo 7 localization swift swiftui ios16 appintents
我正在开发我的 SwiftUI 项目,并为快捷方式应用程序添加了一些 AppIntents。目前我无法本地化标题和描述。标题和描述的类型为 LocalizedStringResource(iOS16+ 提供)。
我尝试将以下代码本地化为德语,但我不知道该怎么做。
struct Add_Memory_Shortcut: AppIntent {
// The name of the action in Shortcuts
// TODO: Localization
static var title : LocalizedStringResource = "Create Memory"
// Description of the action in Shortcuts
// Category name allows you to group actions - shown when tapping on an app in the Shortcuts library
static var description: IntentDescription = IntentDescription("Create a new memory", categoryName: "Creating")
}
Run Code Online (Sandbox Code Playgroud)
任何帮助或链接表示赞赏。谢谢 :)
我尝试了所有方法,只有一件事有效,将您的本地化字符串添加到
Localizable.strings
Run Code Online (Sandbox Code Playgroud)
如果你想用参数本地化字符串
//Localizable.strings
"hello_user%@" = "Hello %@";
//Your AppIntents
let welcomeMSG = LocalizedStringResource("hello_user\(userName)")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1820 次 |
| 最近记录: |