admin管理员组文章数量:1335554
I'm curious, does anyone know what the steps are to get from a LocalizedStringKey
to a normal String
in Swift? There are plenty of resources on the results of feeding in a LocalizedStringKey
to SwiftUI initialisers, but I can't find anything that lets you reproduce the inner workings of SwiftUI to do the localization.
For example, consider the following code:
private func localize(_ key: LocalizedStringKey) -> String {
// This is the part that I need
return "Bonjour"
}
struct Greeter: View {
var greetingKey: LocalizedStringKey
var body: some View {
let localGreeting = localize(greetingKey)
let modifiedGreeting = "
本文标签:
swiftHow to get localised String from LocalizedStringKeyStack Overflow
版权声明:本文标题:swift - How to get localised String from LocalizedStringKey - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人,
转载请联系作者并注明出处:http://www.betaflare.com/web/1742394161a2466581.html,
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论