Class Messages

java.lang.Object
io.mangoo.i18n.Messages
All Implemented Interfaces:
Serializable

public class Messages extends Object implements Serializable
Convenient class for handling translations
Author:
svenkubiak
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(Key key, Object... arguments)
    Returns a localized value for a given key stored in messages_xx.properties and passing the given arguments
    get(String key)
    Returns a localized value for a given key stored in messages_xx.properties
    get(String key, Object... arguments)
    Returns a localized value for a given key stored in messages_xx.properties and passing the given arguments
    void
    reload(Locale locale)
    Refreshes the resource bundle by reloading the bundle with the default locale

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Messages

      public Messages()
  • Method Details

    • reload

      public void reload(Locale locale)
      Refreshes the resource bundle by reloading the bundle with the default locale
      Parameters:
      locale - The locale to use
    • get

      public String get(String key)
      Returns a localized value for a given key stored in messages_xx.properties
      Parameters:
      key - The key to look up the localized value
      Returns:
      The localized value or an empty value if the given key is not configured
    • get

      public String get(String key, Object... arguments)
      Returns a localized value for a given key stored in messages_xx.properties and passing the given arguments
      Parameters:
      key - The key to look up the localized value
      arguments - The arguments to use
      Returns:
      The localized value or null value if the given key is not configured
    • get

      public String get(Key key, Object... arguments)
      Returns a localized value for a given key stored in messages_xx.properties and passing the given arguments
      Parameters:
      key - The key enum to lookup up the localized value
      arguments - The arguments to use
      Returns:
      The localized value or null value if the given key is not configured