Interface ResourceBundle


public interface ResourceBundle
A ResourceBundle is a set of Strings identified by keys A ResourceBundle is associated with a Locale making the Strings specific for that Locale. ResourceBundles can be obtained by name from the LocalizationService. ResourceBundles are ordered in a fallback hierarchy. If a String is not defined in the current bundle the call is forwarded to the parent bundle. See LocalizationService for an exact description.
  • Method Details

    • getLocale

      Locale getLocale()
      The Locale of this ResourceBundle.
    • getName

      String getName()
      The name of this ResourceBundle.
    • getString

      String getString(String key)
      Gets the Locale-specific translation identified by a given key. If a String is not defined in this bundle the call is forwarded to the parent bundle.
      Parameters:
      key - a key identifying a String
      Returns:
      the String identified by a key
    • getString

      default String getString(String key, Map<String,String> parameters)
      Gets the Locale-specific translation identified by a given key. If a String is not defined in this bundle the call is forwarded to the parent bundle.

      Variables in the Strings can be replaced by supplying parameters. The default definition of a variable is ${variableName}. If the label has only one variable use getString(String, String, String).

      Parameters:
      key - a key identifying a String
      parameters - a map of names and values to replace variables
      Returns:
      the String identified by a key with replaced variables
    • getString

      default String getString(String key, String parameterName, String parameterValue)
      Gets the Locale-specific translation identified by a given key. If a String is not defined in this bundle the call is forwarded to the parent bundle.

      One variable in the String can be replaced by the parameterName and parameterValue. The default definition of a variable is ${variableName}. Convenience method for Strings with only one variable. If there are multiple variables use getString(String, Map).

      Parameters:
      key - a key identifying a String
      parameterName - the name of the variable as defined in the String
      parameterValue - the replacement value for the variable
      Returns:
      the String identified by a key with replaced variables
    • toJavaResourceBundle

      default ResourceBundle toJavaResourceBundle()