I have to create an app Which will work in different languages and show the content of app in different languages that i select from the language list. I have list of three languages :- 1. English , 2. Hindi and 3. Spanish .
What are the steps to make the app support multiple languages . right now my app is working only with english language.
I'm expecting as i change select a different language the whole text of my app get converted into the selected language.
you have to create the localisation file steps are :
"sign" = "Sign";
"continue" = "Continue";
and below code in the Hindi localisation file
"sign" = "साइन इन करें";
"continue" = "जारी रखें";
and similar content in each localisation file with their translation
extension String {
func localizeString(string: String) -> String {
let path = Bundle.main.path(forResource: string, ofType: "lproj")
let bundle = Bundle(path: path!)
return NSLocalizedString(self, tableName: nil, bundle: bundle!,
value: "", comment: "")
}
}
let langCode = "en"
yourLbl.text = "sign".localizeString(string: langCode)