Java examples for java.util:ResourceBundle
get Resource Bundle String
import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.faces.context.FacesContext; public class Main{ public static String getResourceBundleString(String resourceBundleName, String resourceBundleKey) throws MissingResourceException { FacesContext facesContext = FacesContext.getCurrentInstance(); String messageBundleName = facesContext.getApplication() .getMessageBundle();//w w w . j a va2s . c o m Locale locale = facesContext.getViewRoot().getLocale(); ResourceBundle bundle = ResourceBundle.getBundle(messageBundleName, locale); return bundle.getString(resourceBundleKey); } }