Swift Localization
- Open Project properties and under
Localizations
addFrench
toBase
andEnglish-Development Language
- Add a new file called
Localizable.strings
using theNew File
dialog and filtering toStrings File
- Right-click the new file, select
Show File Inspector
and underLocalization
check bothEnglish
andFrench
- Two sub-files under
Localizable.strings
should have appeared
To preview a language in SwiftUI
struct HomeView_Previews: PreviewProvider {
static var previews: some View {
HomeView()
.environment(\.locale, .init(identifier: "fr"))
}
}