zoukankan      html  css  js  c++  java
  • 设置bundle包中的默认语言

    都只能获取中文

    1,

    #define VivienResourceBundle [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"Vivien" ofType:@"bundle"]]

    #define currentLanguageBundle [NSBundle bundleWithPath:[VivienResourceBundle pathForResource:[[NSLocale preferredLanguages] objectAtIndex:0] ofType:@"lproj"]]

    #define An1LocalizedString(key, comment)  NSLocalizedStringFromTableInBundle(key,@"Root",currentLanguageBundle,@"")

     

    2,

    #define VivienResourceBundle [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"Vivien" ofType:@"bundle"]]

    #define currentLanguageBundle  [NSBundle bundleWithPath:[VivienResourceBundle pathForResource:@"en" ofType:@"lproj"]]

    #define An2LocalizedString(key, comment)   [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"Vivien"  ofType:@"bundle"]] localizedStringForKey:(key) value:comment table:@"Root"]

     

    3,

    #define VivienResourceBundle [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"Vivien" ofType:@"bundle"]]

    #define VivienResourceBundle_Language(lang)  [NSBundle bundleWithPath:[VivienResourceBundle pathForResource:(lang) ofType:@"lproj"]]

    #define VivienResourceBundle_DefaultLanguage  [NSBundle bundleWithPath:[VivienResourceBundle pathForResource:@"en" ofType:@"lproj"]]

    //#define AtmobotLocalizedString(key) [VivienResourceBundle_Language([InternationalControl userLanguage]) localizedStringForKey:(key) value:nil table:@"Root"]

    #define An3LocalizedString(key) [VivienResourceBundle_DefaultLanguage localizedStringForKey:(key) value:nil table:@"Root"]

  • 相关阅读:
    ubuntu 12.04(Precise Pangolin)启用休眠(Hibernate)功能的方案
    svn小技巧——重定向svn diff
    引用对象深度复制
    引用对象深度复制的简单实现方法
    vue Excel导出 [post请求+提示语]
    随手笔记-二进制的正负计算
    枚举类的扩展使用
    关于担心java import xxx.*对资源占用的一次小实践
    idea 自动添加注释 (方法+类 带参数/返回值)
    maven打包到本地仓库
  • 原文地址:https://www.cnblogs.com/developer-qin/p/6098346.html
Copyright © 2011-2022 走看看