Class PersonalizedLocalizer

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.localization.PersonalizedLocalizer
All Implemented Interfaces:
ILocalizer

public final class PersonalizedLocalizer extends Object implements ILocalizer
A localizer that uses a specific locale for localization.

This is used to localize messages for a specific client.

  • Constructor Details

    • PersonalizedLocalizer

      public PersonalizedLocalizer(ILocalizer localizer, @Nullable Locale locale)
  • Method Details

    • getMessage

      @Deprecated public String getMessage(String key, @Nullable Locale clientLocale, Object... args)
      Deprecated.
      Using this method will override the locale set in the constructor. Use getMessage(String, Object...) instead.
      Description copied from interface: ILocalizer
      Retrieves a localized message.
      Specified by:
      getMessage in interface ILocalizer
      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

      public String getMessage(String key, Object... args)
      Description copied from interface: ILocalizer
      Retrieves a localized message using the default locale.
      Specified by:
      getMessage in interface ILocalizer
      Parameters:
      key - The key of the message.
      args - The arguments of the message, if any.
      Returns:
      The localized message associated with the provided key.
    • getAvailableLocales

      public List<Locale> getAvailableLocales()
      Description copied from interface: ILocalizer
      Gets a list of Locales that are currently available.
      Specified by:
      getAvailableLocales in interface ILocalizer
      Returns:
      The list of available locales.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object