How to change app language either arabic or english in ios? -
I have an option in Arabic and English. If the user selects an arbic then the whole app will be displayed in Arabic .i has heard of nslocalizedstring I have found a solution for this. I am not clear to show an entrance app. I may have ten view controller , so how do I change the home to viewcontroller . To create a global file for this. Thanks in advance. Try it out This requires complete configuration and files Surgeon. You will not need to change the 10View Controller's language from the Home View Controller, you just have to set the user selected language in NSUserDefault values and later it will be checked in your view controllers if you do a specific task depending on the language is. It sets the Arabic language and for English it Then later in your view controllers you can check it using The storyboard and the NSLCLizedString know which language should automatically use the sitting value for the applet language key from their future string files.
NSUserDefaults * userDefaults = [NSUserDefaults StandardUserDefaults]; [UserDefaults set object: [NSArray arrayWithObjects: @ "ar", @ "n", zero];
[userDefaults set object: [NSArray arrayWithObjects: @ "en", @ "ar", zero];
- (NSString *) getLanguage {NSArray * languages = [[ NSUserDefaults StandardUserDefaults] objectForKey: @ "AppleLanguages"]; NSString * FavoriteLeg = [languagesObjectIndexX: 0]; Return to the preferred length; }
Comments
Post a Comment