从 ResourceBundle 获取整数时,它会被格式化为逗号
year.of.birth={0} was born on {1}
If I pass 2000 or 2008 to {1} the value gets parsed as 2,000 or 2,008.
我不希望逗号作为翻译字符串的一部分。我应该如何避免这种情况?
year.of.birth={0} was born on {1}
If I pass 2000 or 2008 to {1} the value gets parsed as 2,000 or 2,008.
I don't want the commas as part of my translated string. How should I avoid this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是将它们作为字符串传递:
另一种方法是在消息资源中指定数字格式(但只有当格式因语言环境而异时我才会这样做):
The easy way is to pass them as Strings:
An alternative is to specify the number format in the message resource (but I would only do that if the format can vary between locales):