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.
For me, the leading reason (from the Gettext Commons Tutorial) would be:
I18n also supports proper handling of plurals:
System.out.println(i18n.trn("Copied file.", "Copied files.", 1)); // will print "Copied file." System.out.println(i18n.trn("Copied file.", "Copied files.", 4)); // will print "Copied files."
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.
精彩评论