Class Messages


  • public class Messages
    extends Object
    Class that is used to get the NatTable internal localized messages.
    • Method Detail

      • getString

        public static String getString​(String key)
        Returns the translation for the given key according to the current set Locale.
        Parameters:
        key - The NatTable internal translation key.
        Returns:
        The localized String for the given key and the current set Locale.
      • getString

        public static String getString​(String key,
                                       Object... args)
        Returns the translation for the given key according to the current set Locale. It uses MessageFormat to replace placeholders with the given parameter values.
        Parameters:
        key - The NatTable internal translation key.
        args - The parameters that should be used to replace placeholders.
        Returns:
        The localized String for the given key and the current set Locale with replaced placeholders.
      • getLocalizedMessage

        public static String getLocalizedMessage​(String message)
        Checks whether the given message starts with a % sign. If it starts with a percentage sign, the message is treated as properties key and it is tried to retrieve the localization. Otherwise the given message is returned.

        This method returns null in case the given message parameter is null.

        Parameters:
        message - The message for which the localized version is requested
        Returns:
        The localized message if the given value starts with % or the given value itself
        Since:
        1.4
      • changeLocale

        public static void changeLocale​(Locale locale)
        Updates the internal used ResourceBundle for the given Locale.
        Parameters:
        locale - The Locale that should be used by NatTable internally.
        Since:
        1.4