SwiftUI DatePicker day of week language

Viewed 1324

I adjusted the region of the DatePicker via the locale property, but the days of the week and the word time are still displayed in English. How can I change that or what did I do wrong?

DatePicker(selection: $aufgabenEigenschaften.aufgabenDatum) {
    Text("Fällig:")
        .foregroundColor(Color("eigenesColorSet"))
}
.environment(\.locale, Locale.init(identifier: "de_DE"))
.onTapGesture(perform: beschreibungsInhalt)
.padding()

why?

2 Answers

The solution is very simple. The appropriate language is added under the project and the Localizations item.

enter image description here

Just want to add to previous answer (and because I don't have the "reputation" to comment directly in Newcomer's answer), creating a blank Localizable.strings file for the language you need is enough to make it work. You don't have to specify and translate.

Related