zoukankan      html  css  js  c++  java
  • 多语言本地化开发Localized

    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];
    }
  • 相关阅读:
    echarts中3D地球模型
    面试题68
    Java正确创建对象数组
    8.Arrays类和比较器
    7.Base64类和UUID类
    6.大数字处理类
    3.JVM重要知识点
    2.JVM基础知识点
    1.JVM入门知识
    6.适配器模式
  • 原文地址:https://www.cnblogs.com/wuxian/p/4856565.html
Copyright © 2011-2022 走看看