【发布时间】:2021-03-20 08:36:43
【问题描述】:
我正在为我的 Vapor 解决方案使用 Lingo 包,请参阅: https://github.com/vapor-community/Lingo-Vapor,这对 3 种语言非常有效
现在我需要复数来创建我正在创建的弹出窗口:
for i in stride(from: 1, to: 12, by: 1) {
if let description = lingo?.localize("lbl_hour_s", locale: language, interpolations: ["count" : i]) {
option = FormFieldStringOption(key:String(i), label: description)
} else {
option = FormFieldStringOption(key:String(i), label: String(i))
}
duration.options.append(option)
}
我的 Json 文件是这样配置的:
for en_US
"lbl_hour_s" : {"one" : "1 hour", "other" : "%{count} hours"},
for nl_BE
"lbl_hour_s" : {"one" : "%{count} uur", "many" : "%{count} uren", "other" : "%{count} uren"},
(我尝试在 nl 中使用额外的“很多”,但在两种情况下仍然得到相同的错误:
缺少语言环境的复数规则:en_US。将默认为other 规则。
这有什么问题吗?它看起来与文档中的示例相同:
"unread.messages": {
"one": "You have one unread message.",
"other": "You have %{count} unread messages."
或者我需要对 Lingo 进行一些额外的配置吗? (在文档中一无所获)
【问题讨论】:
标签: swift localization vapor lingo