我正在为我的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。将默认为规则.。
这有什么问题吗?它看起来与文档中的示例相同:
"unread.messages": {
"one": "You have one unread message.",
"other": "You have %{count} unread messages."或者我需要一些额外的配置到灵高?(在文档中什么也没有找到)
发布于 2021-03-26 07:47:47
问题是,林戈并没有自动退回到裸露的语言代码多元化规则(例如。当en_US -> en不存在的时候)。
这在3.1.0版本中是固定的。
发布于 2021-03-25 10:33:54
我发现了我的问题。我使用'en_US‘,因为我想在未来提供更多的翻译。显然,对于美国英语,我应该使用'en‘。
在比利时,荷兰语(荷兰语)的“nl_BE”也有同样的问题。我想要这个,因为我也加入了'nl_NL',荷兰的荷兰语口语。两者95%是一样的,但有些词或句子是不同的。
https://stackoverflow.com/questions/66719648
复制相似问题