Interface LocaleManager

All Superinterfaces:
Component, CoreComponent, Manager
All Known Implementing Classes:
LocaleManagerImpl

public interface LocaleManager extends Manager
The localization manager for applications managed by Vertigo, supporting multilingual or more specifically, multidictionary management. External resources are managed in dictionaries, where each resource is identified by a unique key:
Author:
pchretien
See Also:
  • Method Details

    • registerLocaleSupplier

      void registerLocaleSupplier(Supplier<Locale> localeSupplier)
      Registers a strategy to choose a locale.
      Parameters:
      localeSupplier - Supplies a locale in a given context.
    • registerZoneSupplier

      void registerZoneSupplier(Supplier<ZoneId> zoneSupplier)
      Registers a strategy to choose a time zone.
      Parameters:
      zoneSupplier - Supplies a time zone in a given context.
    • add

      void add(String baseName, LocaleMessageKey[] enums)
      Adds a resource dictionary. All resources identified by a key must be present in the properties file. This method is not synchronized and should be called at application startup.
      Parameters:
      baseName - Name and path of the properties file.
      enums - Enumeration (enum) controlling the managed resources.
    • override

      void override(String baseName, LocaleMessageKey[] enums)
      Overrides a resource dictionary. This method is not synchronized and should be called at application startup. It is possible to override only one property or a specific dictionary.
      Parameters:
      baseName - Name and path of the properties file.
      enums - Enumeration (enum) controlling the managed resources.
    • getMessage

      String getMessage(LocaleMessageKey messageKey, Locale locale)
      Retrieves the unformatted label of a message identified by its key. Returns null if the message is not found.
      Parameters:
      messageKey - Message key.
      locale - Locale.
      Returns:
      Unformatted message in the language of the locale.
    • getCurrentLocale

      Locale getCurrentLocale()
      Retrieves the current locale, corresponding to the current user if available, otherwise corresponds to the application's locale.
      Returns:
      Current locale.
    • getCurrentZoneId

      ZoneId getCurrentZoneId()
      Retrieves the current time zone, corresponding to the current user if available, otherwise corresponds to the application's time zone.
      Returns:
      Current time zone.