开发者

always returning english

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜