Class Bundle

java.lang.Object
sonia.scm.i18n.Bundle

public class Bundle extends Object
This class is a wrapper for ResourceBundle, it applies some missing format options missing in ResourceBundle.
Since:
1.15
  • Method Details

    • getBundle

      public static Bundle getBundle(String path)
      Creates a new bundle instance
      Parameters:
      path - path to the properties file
      Returns:
      new bundle instance
    • getBundle

      public static Bundle getBundle(String path, Locale locale)
      Creates a new bundle instance
      Parameters:
      path - path to the properties file
      locale - locale for the properties file
      Returns:
      new bundle instance
    • getBundle

      public static Bundle getBundle(String path, Locale locale, ClassLoader classLoader)
      Creates a new bundle instance
      Parameters:
      path - path to the properties file
      locale - locale for the properties file
      classLoader - classLoader to load
      Returns:
      new bundle instance
      Since:
      1.37
    • getLine

      public String getLine(String key, Object... args)
      This method returns the same value as getString(java.lang.String, java.lang.Object[]) with a line separator at the end.
      Parameters:
      key - key in the properties file
      args - format arguments
      Returns:
      formatted message
    • getString

      public String getString(String key, Object... args)
      Returns the value of the key, formatted with MessageFormat
      Parameters:
      key - key in the properties file
      args - format arguments
      Returns:
      formatted message
    • getStringIfPresent

      public String getStringIfPresent(String key, Object... args)
      Returns the value of the key, formatted with MessageFormat or null if the key is not present in the bundle.
      Parameters:
      key - key in the properties file
      args - format arguments
      Returns:
      formatted message or null
      Since:
      1.37