问题
in my project, there is a content section. where user can view contents in four diff languages. Is there any way, that i put contents in one language, and according to user's choice my java program translate it to the selected language and now user can view it to that selected language.(Say for example translate English to French)
回答1:
http://code.google.com/apis/language/translate/overview.html
Google Translate provides an API for just that. Of course, the translations aren't always good.
And you have to pay money for it.
Alternative: you write your content in every language you support, and at the correct event you update the UI with another version.
回答2:
I assume that you're not talking about machine translation. Take a look at ResourceBundles, but the solution depends also on the frameworks you are using.
回答3:
Depending on your implementation ResourceBundles may be what you are looking for, see:
http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/
and
http://download.oracle.com/javase/6/docs/api/java/util/ResourceBundle.html
来源:https://stackoverflow.com/questions/7580465/how-to-translate-one-language-to-another-using-java-programming