iOS国际化解决方案

1.新增InfoPlist.strings文件,文件名必须为infoPlist.strings。

2.点击右侧添加其他国际化文件

 3.

@property(nonatomic,strong)NSBundle *bundle;

实现切换 NSString *path = [[NSBundle mainBundle]pathForResource:language ofType:@"lproj"];

        self.bundle = [NSBundle bundleWithPath:path];

4.文本替换

-(NSString *)getStringForKey:(NSString *)key withTable:(NSString *)table {

    if (self.bundle) {

        return NSLocalizedStringFromTableInBundle(key, table, self.bundle, @"");

    }

    return NSLocalizedStringFromTable(key, table, @"");

}