Objective-C:我的 Localizable.strings 不工作

Objective-C: my Localizable.strings doesn't work

我尝试本地化我的程序。但它并不顺利.. 我有 Localizable.strings:

"News" = "Новости";

还有我的自定义标签栏 class 我把

[tabBarItem setTitle:NSLocalizedString(@"News", nil)];

而且它不起作用。 "News" 就是我在选项卡上看到的所有内容。我尝试清除缓存但没有帮助。好的,我检查了 Localisable 文件是否已添加到目标,我在我的代码中添加了 NSLog(@"MY NEWS TAG: %@", NSLocalizedString(@"News", nil)) 行。它只是打印 "News"。 然后我添加 NSLog(@"localeIdentifier: %@", [[NSLocale currentLocale] localeIdentifier]); 并打印 localeIdentifier: en_US!!!但是 iOS Simulator UI 有不同的语言。看来我弄错了 localeIdentifier!为什么会这样?

我在这里找到:XCode 5/iOS 7 - localization not working in simulator

If you are using xcode 6.1.1 and iOS sdk 8.1,try this workaround.

It seems localization does not work with xCode 6.1 and 8.1 simulator. Workaround: Go to "edit schemes" >> "Run" (side bar) >> "Options" tab

"Application Language" Select the language you wish to run the app on the simulator. I got this workaround from Workaround by natanavra Thanks to him.

但是我在开发者论坛上看到它在 6.2 beta 中工作 Xcode 的版本。希望如此。

妈的!原来如此!