swift – IOS: AppleLanguages not taking impact after app restart (typically)


I am calling UserDefaults.commonplace.setValue(["ru"], forKey: "AppleLanguages") to alter the app language with my GUI, after which I ask the consumer to restart the app so the change will take impact.

The issue is typically, after setting the AppleLanguages UserDefaults, and restarting the app, nothing adjustments, and the app Locale.present.identifier,(and the entire app lang) stays the identical.

More often than not it really works, however when it would not, I’ve to set the worth and restart the app a number of occasions earlier than it lastly adjustments the language. I do not know what the issue is said to because it appeared in one of many variations and nothing modified within the a part of setting the language.

I’ve tried calling UserDefaults.commonplace.set as a substitute of UserDefaults.commonplace.setValue, or calling UserDefaults.commonplace.synchronize(), however nothing labored.

Any assist shall be appreciated.


Leave a Reply

Your email address will not be published. Required fields are marked *