我目前正在尝试将我的iOS应用程序本地化为法语。因为某种原因我的钥匙没有被正确识别。我的.strings
法语文件如下所示:
"START_FLIGHT" = "Démarrez";
"STOP_FLIGHT" = "Arrêtez";
但当我打电话:
let title = NSLocalizedString("STOP_FLIGHT", comment: "Stop Flight")
StartandStop.setTitle(title, forState: UIControlState.Normal)
按钮的标题被更改为STOP_FLIGHT
,在这里,我打算将标题变为Arrêtez
。我出什么问题了?
发布于 2015-01-18 02:06:44
我想:)
您必须指定tableName (在大多数情况下,这是Storyboard的名称),类似于以下两种方法
let titleStr = NSBundle.mainBundle().localizedStringForKey("STOP_FLIGHT", value: "default stop flight", table:"Main")
let anotherTitle = NSLocalizedString("STOP_FLIGHT", tableName: "Main", comment: "Comment")
发布于 2015-01-18 02:06:35
因此,本地化的字符串文件只能是表单Localizable.strings
,而我已经将其命名为Localization.strings
。
https://stackoverflow.com/questions/28006185
复制相似问题