How to ignore the system default Locale to retrieve resourceBundle

核能气质少年 提交于 2019-12-05 06:26:17

You can do that by using a custom ResourceBundle.Control, either by overloading the getFallbackLocaleexplicitly, or by using :

ResourceBundle.getBundle("name", new Locale("en", "US"), ResourceBundle.Control.getNoFallbackControl(ResourceBundle.Control.FORMAT_PROPERTIES))

The bundle you are looking for is called the baseBundle, and it can be obtained with ease using Locale.ROOT as the Locale. Like this:

ResourceBundle.getBundle("bundle name",Locale.ROOT)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!