step 1 : Add the Language
-->file will added like above image
Step - 2 : Add the String file
create String file and rename it as "Localizable.strings"
Step - 2 : Add the String file
create String file and rename it as "Localizable.strings"
Step 3 : Configure String file for Localization
Step - 4 : Add the key values to get the value
note: we may check files are created in currect format or not by using cmds
cd
into your project rootcd en.lproj
- you can replace this with any localisation you are working with.plutil -lint Localizable.strings
step - 5:
we can switch the language on buttons like
@IBAction func english(_ sender: Any) {
let path = Bundle.main.path(forResource: "en", ofType: "lproj")
let bundel = Bundle.init(path:path!)! as Bundle
countryName.text=bundel.localizedString(forKey: "usernametitle", value: nil, table: nil)
}
//pt-PT.lproj
@IBAction func protual(_ sender: Any) {
let path = Bundle.main.path(forResource: "pt-PT", ofType: "lproj")
let bundel = Bundle.init(path:path!)! as Bundle
countryName.text=bundel.localizedString(forKey: "usernametitle", value: nil, table: nil)