NSString * ViewsLocalizedStringFormat(NSString *key,NSString *defValue);

// Handle localized strings stored in a bundle

NSString * ViewsLocalizedStringFormat(NSString *key,NSString *defValue)
{
    static NSBundle *viewsBundle = nil;
    if (viewsBundle == nil) {
        NSBundle *viewBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"views" ofType:@"bundle"]];
        viewsBundle = [NSBundle bundleWithPath:[viewBundle pathForResource:[[NSLocale preferredLanguages] objectAtIndex:0] ofType:@"lproj"]];
        if (viewsBundle == nil) {
            
            viewsBundle = [NSBundle bundleWithPath:[viewBundle pathForResource:@"en" ofType:@"lproj"]];
        }
    }
    if (defValue==nil) {
        defValue=key;
    }
    return [viewsBundle localizedStringForKey:key value:defValue table:nil];
}

 

相关文章:

  • 2021-12-16
  • 2021-07-12
  • 2022-01-23
  • 2021-12-19
  • 2022-12-23
  • 2021-12-02
  • 2021-08-17
猜你喜欢
  • 2021-04-14
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-10-02
相关资源
相似解决方案