• 设置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"]

  • 相关阅读:
    [POJ1724]ROADS
    表达式求值
    [NOIp2017提高组]奶酪(BFS)
    [NOIp2012提高组]Vigenère 密码
    [NOIp2012提高组]国王游戏
    [POJ1321]棋盘问题
    [POJ3009]Curling2.0
    垃圾陷阱
    2019CSP day1t2 括号树
    2019CSP游记
  • 原文地址:https://www.cnblogs.com/developer-qin/p/6098346.html
Copyright © 2020-2023  润新知