Localizable.strings(英文)不起作用但InfoPlist.strings(英文)有效吗?

2 iphone localization ios

在.m文件中:

UIActionSheet *someSheet = [[UIActionSheet alloc] 
    initWithTitle:NSLocalizedString(@"TITLE", nil)
    delegate:self 
    cancelButtonTitle:@"CANCEL"
    destructiveButtonTitle:nil
    otherButtonTitles:@"option1", @"option2", nil
];
Run Code Online (Sandbox Code Playgroud)

Localizable.strings (English)我设定"TITLE" = "Share";

InfoPlist.strings (English)我设定CFBundleDisplayName="AppName123";

然后我将我的iphone的语言切换到另一个尚未本地化的语言(例如日语).

在跳板中,App的名称确实改为"AppName123",但在运行时我看到"TITLE"应该是"Share".

该应用尚未针对日语本地化,为什么它不使用英语作为默认值?

任何人都可以告诉我什么是错的?谢谢!

Rup*_*tel 5

请尝试此代码

在Localizable.strings文件中

"FirstName" = "XYZ";
Run Code Online (Sandbox Code Playgroud)

在您的.m文件中

NSString *string = NSLocalizedString(@"FirstName",@"");
Run Code Online (Sandbox Code Playgroud)

要么

NSString *string = NSLocalizedString(@"FirstName",nil);
Run Code Online (Sandbox Code Playgroud)