How to show localized text in SwiftUI

Issue #533

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)
        }
    }
}
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation