Interface ILocalizer

All Known Implementing Classes:
ILocalizer.DummyLocalizer, PersonalizedLocalizer

public interface ILocalizer
Represents a class that can localize strings.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    A dummy localizer that returns the key, locale and arguments in a string.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ILocalizer
    A dummy localizer that returns the key, locale and arguments in a string.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets a list of Locales that are currently available.
    default String
    getMessage(String key, Object... args)
    Retrieves a localized message using the default locale.
    getMessage(String key, @Nullable Locale clientLocale, Object... args)
    Retrieves a localized message.
  • Field Details

    • NULL

      static final ILocalizer NULL
      A dummy localizer that returns the key, locale and arguments in a string.
  • Method Details

    • getMessage

      String getMessage(String key, @Nullable Locale clientLocale, Object... args)
      Retrieves a localized message.
      Parameters:
      key - The key of the message.
      clientLocale - The Locale configured for the client. If the configuration does not allow client-specific locales or if the provided Locale is null, this parameter is ignored.
      args - The arguments of the message, if any.
      Returns:
      The localized message associated with the provided key.
    • getMessage

      default String getMessage(String key, Object... args)
      Retrieves a localized message using the default locale.
      Parameters:
      key - The key of the message.
      args - The arguments of the message, if any.
      Returns:
      The localized message associated with the provided key.
      Throws:
      MissingResourceException - When no mapping for the key can be found.
    • getAvailableLocales

      List<Locale> getAvailableLocales()
      Gets a list of Locales that are currently available.
      Returns:
      The list of available locales.