iOS NSLocale(本地化语言)

//联系人:石虎QQ: 1224614774昵称:嗡嘛呢叭咪哄

1.获取所有本地化语言标示符

[NSLocale availableLocaleIdentifiers];

2.获取当前系统语言标识符

[[NSLocale currentLocale] localeIdentifier];

3.获取本地化对象的具体内容

NSLocale *local = [NSLocale currentLocale];

4.获取用户语言偏好设置列表

[NSLocale preferredLanguages];

5.根据本地标识符创建NSLocale

NSLocale *local = [[NSLocale alloc] initWithLocaleIdentifier:@"zh-Hans_US"];

6.监听用户本地化设置的消息

//在localChangedHandler方法中做操作即可.

[[NSNotificationCenter defaultCenter] addObserver:selfselector:@selector(localChangedHandler) name:NSCurrentLocaleDidChangeNotification object:nil];

谢谢!!!

你可能感兴趣的:(iOS NSLocale(本地化语言))