The code gets an array of internationalization languages

Gets the language used by the current app

NSArray *langArr1 = [[NSUserDefaults standardUserDefaults] valueForKey:@"AppleLanguages"]; NSString *language1 = langArr1.firstObject; NSLog(@" Emulator language: %@",language1);Copy the code

En indicates English, zh-Hans simplified Chinese, and zh-hant traditional Chinese.

NSArray *lans = @[@"en"];
    [[NSUserDefaults standardUserDefaults] setObject:lans forKey:@"AppleLanguages"];
Copy the code

Changing the Startup language of Scheme –

-applelanguages (zh-Hans) stands for simplified Chinese. -applelanguages (zh-hant) stands for traditional Chinese. -applelanguages (en) stands for English

Internationalization takes different image codes

#import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; PNG // if xxx.jpg must be written replace XXX with xxx.jpg NSString *imageName = NSLocalizedString(@" XXX ", nil); self.imageView.image = [UIImage imageNamed:imageName]; } @endCopy the code

Citation: Original address