我正在使用可本地化文件,目前我有两种语言英语 - 开发语言,另一种是波斯语(fa-ir) 所以我的基本语言现在是英语,即如果我的设备有西类牙语,则将以英语执行。
现在我想将我的基本语言英语更改为波斯语。
最佳答案
您可以更改字符串路径,如下所示
objective-c
NSString *path = [[NSBundle mainBundle ] pathForResource:@"en" ofType:@"lproj"]; // in place of "en" you can change put your locale code.
NSBundle *bundle = [NSBundle bundleWithPath:path] ;
NSString *string = [bundle localizedStringForKey:key value:@"" table:nil];
swift 3
let bundle = Bundle.main
bundle.path(forResource: "en" as String, ofType: "lproj")// in place of "en" you can change put your locale code.
let string = bundle.localizedString(forKey: key, value: "", table: nil)
关于iOS swift 如何更改英语以外的基本语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43510317/