当我在这一行使用时
alertView.message=NSLocalizedString("Please_enter_all_fields",comment:"Please_enter_all_fields")
警告弹出消息显示Please_enter_all_fields
,但我被声明为Localized.string
文件:Please_enter_all_fields="Please enter all fields"
。
如何显示与Localized.string
变量声明的字符串相关的警报消息?
答案 0 :(得分:2)
let title = NSLocalizedString("TITLE", comment: "TITLE")
let msg = NSLocalizedString("Please_enter_all_fields", comment: "Please_enter_all_fields")
let alert = UIAlertController.init(title: title, message: msg, preferredStyle: .alert)
NSLocalizedString默认为"英语 - 开发语言"。
您可以根据需要定义值
let msg = NSLocalizedString("Please enter all fields", comment: "Please enter all fields")
或者你必须添加"英语"本地化,并在内部翻译" Localizable.String(英语(美国))"
/* Please_enter_all_fields */
"Please_enter_all_fields" = "Please enter all fields";
答案 1 :(得分:1)
可能是错的
Please_enter_all_fields ="请输入所有字段"
必须设置如下:
" Please_enter_all_fields" ="请输入所有字段";