Class InoNls

java.lang.Object
de.mid.innovator.util.InoNls

public class InoNls extends Object
The class provides several utility methods for creating localized messages. It unifies the way in which you can access a message resource and how the keys that should be used are named.
Author:
borschet
  • Constructor Details

    • InoNls

      public InoNls()
  • Method Details

    • Msg

      public static String Msg(String key, Object... args)
      Finds the message with the given key according to the default locales.
      Parameters:
      key - a valid message key that can be used to find a message
      args - various arguments to be formatted with the message
      Returns:
      the string message
    • MsgPrefix

      public static String MsgPrefix(String prefix, String key, Object... args)
    • Msg

      public static String Msg(Locale locale, String key, Object... args) throws MissingResourceException
      Finds the message with the given key and the given locales. The method tries to calculate the path of the resource bundle from the given key. Starting with the actual package, it searches for a bundle with the name "messages" and tries to find the key inside the bundle. If no such key is found, the key is separated into two parts at the position of the last dot in its name. The first part is considered as a package path name and the second part is used as a key name. This key is searched in every package and its container. The first hit is used to format the message which will be returned. If the key is not found in any of the retrieved packages, a default bundle (de.mid.innovator.messages) is used to get the message.
      Parameters:
      locale - valid Java locale
      key - a valid message key that can be used to find a message
      args - various arguments to be formatted with the message
      Returns:
      the string message
      Throws:
      MissingResourceException - If the key could not be found in any processed bundle.