相关疑难解决方法(0)

iPhone/iOS:如何在我的应用程序本地化的所有语言中获取本地化字符串列表?

我需要向服务器发送特定字符串的本地化列表.

这意味着,如果我的应用程序有一个字符串Foo,其本地化为英语为@"Foo",俄语为@"Фу",我想向服务器发送如下列表:

  • String Foo:
    • 英语:"Foo"
    • 俄语:"Фу"

我认为我需要做的是:

  1. 枚举我的应用程序本地化的每种语言的本地化字符串
  2. 获取每种语言的本地化版本的Foo

我该怎么做(1)我该怎么做(2)?

iphone localization nslocalizedstring ios

16
推荐指数
1
解决办法
1万
查看次数

使用警报按钮的标准Apple翻译?

这是真的?实例化UIAlertButton时,必须为"取消"按钮传递一个显式标题,如下所示:

UIAlertView *av = 
    [[UIAlertView alloc] 
         initWithTitle:@"Error" 
         message:err.localizedDescription 
         delegate:nil 
         cancelButtonTitle:@"Cancel" 
         otherButtonTitles:nil];
Run Code Online (Sandbox Code Playgroud)

这意味着如果你想要一个本地化的应用程序(你当然可以这样做),你也必须本地化取消字符串,即使Apple显然已经有了规范的翻译.我真的被迫写这样的东西来处理它(或者这甚至可以)?

NSBundle* uikitBundle = [NSBundle bundleForClass:[UIButton class]];
UIAlertView *av = 
    [[UIAlertView alloc] 
         initWithTitle:NSLocalizedString(@"Error", @"Title for Alert box when error occurs") 
         message:err.localizedDescription 
         delegate:nil 
         cancelButtonTitle:NSLocalizedStringFromTableInBundle(@"Cancel", @"Localizable", uikitBundle, nil) 
         otherButtonTitles:nil];
Run Code Online (Sandbox Code Playgroud)

这对我来说太可怕了,但我必须保持自己的Apple HIG强制翻译单词(如"取消"或"确定")的想法似乎同样荒谬.

translation localization uialertview ios

11
推荐指数
1
解决办法
2199
查看次数