gettext (gettext-commons) 或坚持使用 java i18n
我们目前正在i18n'g我们的平台。平台和在此平台上构建的产品的代码库非常庞大,并且具有许多硬编码字符串(除了我们外部化标签等的 UI)。
我需要一些关于使用 gettext 或 Java i18n 的建议。我对 gettext 的好处和理解只有有限的理解。除了 Java i18n 已经提供的功能之外,gettext 还提供什么功能?
先感谢您。
We are currently i18n'g our platform. The code base for platform and the product's built on this platform is huge and has many hard coded strings (except the UI where we externalized the labels etc).
I need some suggestions on to use gettext or Java i18n. I only have limiting understanding on the benefits and understanding of gettext. What is gettext going to provide other than what is already provided by Java i18n?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对我来说,主要原因(来自 Gettext共享教程)将是:
这个例子不是最好的。它应该说“支持在目标语言中正确处理复数”。这是因为有些语言可能有不止一种复数形式(事实上,有很多这样的语言)。
此外,您还将有一种后备语言(我猜是英语)集成到您的源代码中,这很好(我相信显示英语文本比显示键名更好)。
我担心的一个问题,但它可能是无效的:虽然 Gettext Commons 是根据 Apache 2.0 许可证的条款发布的,但它需要在系统上安装 Gnu gettext,并且(如果我错了,请纠正我)这是 GPL 许可的(或者如果您碰巧运行 Linux,则获得 L-GPL 许可)。如果我的假设是正确的,这意味着除非您的应用程序仅适用于 Linux,否则您必须将其开源。
For me, the leading reason (from the Gettext Commons Tutorial) would be:
This example is not the best. It should say "supports proper handling of plurals in target languages". That's because there are languages that could have more than one plural form (there are quite a few languages like that, in fact).
Also, you will have a fallback language (English, I guess) integrated into your source code which is good (I believe it is better to show English text than a key name).
The one concern that I have, but it might be invalid: although the Gettext Commons are released under the terms of the Apache 2.0 license, it requires Gnu gettext installed on the system, and (correct me if I am wrong) that is GPL licensed (or L-GPL licensed if you happen to run Linux). If my assumptions are correct, this would mean that unless your application is Linux-only, you would have to open source it.