我正在为我的 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 中使用额外的 'many',但在两种情况下仍然得到相同的错误:
缺少语言环境的复数规则:en_US。将默认为other
规则。
这有什么问题吗?它看起来与文档中的示例相同:
"unread.messages": {
"one": "You have one unread message.",
"other": "You have %{count} unread messages."
还是我需要对 Lingo 进行一些额外的配置?(在文档中没有找到任何东西)