开发者

always returning english

开发者 https://www.devze.com 2023-02-07 06:24 出处:网络
Here is my code: NSString *string = [bundle localizedStringForKey:@\"kTCStringMissing\" value:@\"\" table:nil];

Here is my code:

    NSString *string = [bundle localizedStringForKey:@"kTCStringMissing" value:@"" table:nil];

I know that the bundle variable is pointing to the correct bundle because the English value is coming out correctly -- see below.

My bundle structure looks like this:

ToyCalculatorUI.bundle  
  en.lproj [directory]  
    Localizable.strings [file]
  de.lproj [directory]
    Localizable.strings [file]

My Localizable.strings look like this:

in the en.lproj directory:

kTCStringMissing = "Missing Fields en";

in the de.lproj directory:

kTCStringMissing = "Missing Fields de";

But when I run my app in the simulator, after setting the language to Deutsch, and the region to Deutschland, the *string object above always has value "Missing Fields en".

What am开发者_如何学运维 I missing?


imho you have to quote the keys, too. (see Apple's Resource Programming Guide for details)

i.e. "kTCStringMissing" = "Missing Fields en";

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号