How to show localized text in SwiftUI

Issue #533

1
2
3
4
5
6
7
8
9
10
11
12
struct ContentView: View {
@Environment(\.locale) var locale: Locale

var body: some View {
VStack {
Text(LocalizedStringKey("hello"))
.font(.largeTitle)
Text(flag(from: locale.regionCode!))
.font(.largeTitle)
}
}
}

Comments