Example usage for java.util ResourceBundle getBundle

List of usage examples for java.util ResourceBundle getBundle

Introduction

In this page you can find the example usage for java.util ResourceBundle getBundle.

Prototype

@CallerSensitive
public static ResourceBundle getBundle(String baseName, Module module) 

Source Link

Document

Gets a resource bundle using the specified base name and the default locale on behalf of the specified module.

Usage

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

}

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

    ClassLoader cl = ClassLoader.getSystemClassLoader();
    ResourceBundle.clearCache(cl);
}

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

    System.out.println(bundle.getLocale().toString());

}

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

    ResourceBundle.clearCache();// w  w w . jav  a 2 s.  c  o m

}

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

    System.out.println(bundle.keySet());

}

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

    System.out.println(bundle.containsKey("bye"));

    System.out.println(bundle.containsKey("hello"));

}

From source file:Main.java

  public static void main(String[] argv) throws Exception {

  ResourceBundle rb = ResourceBundle.getBundle("res.ResourcesDynamic", Locale.getDefault());
  System.out.println(rb.getString("title"));
}

From source file:Main.java

public static void main(String[] args) {
        ResourceBundle bundle = ResourceBundle.getBundle("MessagesBundle", Locale.UK);
        System.out.println("Message in " + Locale.UK + ": " + bundle.getString("greeting"));

        Locale.setDefault(new Locale("in", "ID"));
        bundle = ResourceBundle.getBundle("MessagesBundle");
        System.out.println("Message in " + Locale.getDefault() + ": " + bundle.getString("greeting"));
    }/*from w w  w  .j av  a  2 s  .c o  m*/

From source file:Main.java

public static void main(String[] args) {

    ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

    System.out.println(bundle.getString("hello"));

    Enumeration<String> enumeration = bundle.getKeys();

    while (enumeration.hasMoreElements()) {
        System.out.println(enumeration.nextElement());
    }//from  ww  w .j a va2s.c o m

}

From source file:Main.java

public static void main(String[] args) {
    ResourceBundle resource = ResourceBundle.getBundle("Messages", Locale.UK);

    Properties properties = convertResourceBundleToProperties(resource);

    Enumeration keys = properties.keys();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        String value = (String) properties.get(key);
        System.out.println(key + " = " + value);
    }//from ww w . ja v a  2 s .c om
}