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

2.点击右侧添加其他国际化文件iOS国际化解决方案

 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, @"");

}

相关文章:

  • 2021-09-20
  • 2021-08-19
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-11
  • 2022-12-23
  • 2021-11-18
  • 2021-09-11
  • 2021-10-05
  • 2022-12-23
相关资源
相似解决方案