List of usage examples for java.util ResourceBundle getBundle
@CallerSensitive public static ResourceBundle getBundle(String baseName, Locale targetLocale, ClassLoader loader, Control control)
From source file:Main.java
public static void main(String[] args) { ClassLoader cl = ClassLoader.getSystemClassLoader(); ResourceBundle.Control rbc = ResourceBundle.Control.getControl(Control.FORMAT_DEFAULT); ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US, cl, rbc); System.out.println(bundle.getString("hello")); }
From source file:de.unentscheidbar.validation.swing.DefaultMessageTextGetter.java
@Override public boolean hasText(Id messageId, Locale locale) { try {/*from w w w . j a v a 2 s .co m*/ String bundleName = getBundleName(messageId); ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale, messageId.getClass().getClassLoader(), STRICT_CONTROL); Object resource = bundle.getObject(messageId.name()); return resource != null; } catch (MissingResourceException e) { return false; } }