your code seems good, but I tried ...
When you change the language from the application, then ...
Bundle.setLanguage("fr") UserDefaults.standard.set(["fr"], forKey: kAppleLanguages) UserDefaults.standard.synchronize() NotificationCenter.default.post(name: NSNotification.Name.init("AppLanguageChangeNotification"), object: nil)
therefore, when the language changes, this notification will be launched, and the view controller that added the observer to it will be notified and it is necessary to change in accordance with this language.
Add Observer
NotificationCenter.default.addObserver(viewController, selector: #selector(self.setLocalization), name: NSNotification.Name.init("AppLanguageChangeNotification"), object: nil)
Method
@objc fileprivate func setLocalization() { self.lblProfile.text = NSLocalizedString("lblProfile", comment: "") self.lbDetails.text = NSLocalizedString("lblDetails", comment: "") . . }
Yes, this is a bit-log process, since you need all IBOutles to set localized text.
source share