首先需要想辦法如何取到當地語系化資料
NSString *loc = @"zh-Hans";
if (![self isChinese]) {
loc = @"en";
}
NSString *path = [[NSBundle mainBundle] pathForResource:_file
ofType:@"strings"
inDirectory:nil
forLocalization:loc];
// compiled .strings file becomes a "binary property list"
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *str = [dict objectForKey:_key];
if (str) {
return str;
}
return _key;
全站熱搜
留言列表