I am trying to change the language inside my app based on what the user decides. I have tried the following with no luck and was wondering if someone could help point me in the right direction?
Asked
Active
Viewed 45 times
0
-
1Do you mean you want them to be able to choose a different language to the device language? – SimonMoss Nov 18 '21 at 07:01
-
Does it help? https://stackoverflow.com/questions/29985614/how-can-i-change-locale-programmatically-with-swift – lazarevzubov Nov 18 '21 at 07:24
2 Answers
0
You have to use localizable strings, kindly check the following link: Swift App localization
Omar Salah Elboredy
- 427
- 2
- 8
0
I was able to figure it out by removing the object value first before setting it. That enabled me to get the language to change in the app. Thanks everyone. Solution:
NSUserDefaults.standardUserDefaults().removeObjectForKey("AppleLanguages")
NSUserDefaults.standardUserDefaults().setObject(["de"], forKey: "AppleLanguages"
NSUserDefaults.standardUserDefaults().synchronize()
A5omic
- 55
- 7