属性文件中的选择模式 [英] Choice pattern in properties file

查看:125
本文介绍了属性文件中的选择模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含消息的属性文件,我想处理一些复数的特殊情况。现在我使用:

I have a properties file with messages and I want to handle some special cases of plural. Now I use:

xxx.yyy.plural=test{0,choice,2#y}

但它也将12格式化为'testy'。如何指定2作为完全匹配?

but it formats 12 as 'testy' also. How can I specify 2 as exact match?

推荐答案

我找到了答案。似乎只有在指定了多个选项时,属性文件中的choice语句才能正常工作。所以你必须指定至少一个else分支
如果我改写我的例子:

I found an answer. It seems that choice statement in properties file works properly only if more than one choice is specified. So you have to specify at least one "else branch" If i rewrite my example:

xxx.yyy.plural={0,choice,2#testy|2<test}

这篇关于属性文件中的选择模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆