Is it possible to do this operation after the ResourceBundle has already been loaded? I'm working under Tomcat and have tried different code examples but none of them worked for me. Any suggestion?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
No, you can't change the locale of a bundle. But you can reload the same bundle base name using another locale:
bundle = ResourceBundle.getBundle("my.base.name", otherLocale);
回答2:
Call
ResourceBundle.clearCache();
then load your bundle again with the locale you want.