Interface I18nContext

All Known Implementing Classes:
DefaultI18nContext, I18nSpringContext

@API(status=STABLE, since="0.1") public interface I18nContext
Interface for I18N context. Contains the data required to return the I18N texts in user's language.
Since:
0.1
Version:
1.0, 2021-01
Author:
(w) Iker Hernaez
  • Method Details

    • getInstance

      @API(status=EXPERIMENTAL, since="0.1") @NotNull static @NotNull I18nContext getInstance()
      Return the I18nContext associated with the current Thread.
      Returns:
      The I18N context.
    • getProviderUUID

      @NotNull @NotNull UUID getProviderUUID()
      Returns the UUID of the provider owner of this context.
      Returns:
      The UUID of the provider owner of this context
    • getLocale

      @NotNull @NotNull Locale getLocale()
      Returns the user's language.
      Returns:
      The user's language
    • setLocale

      void setLocale(Locale language)
      Sets the user's language. If the argument is null the JVM default language is set.
      Parameters:
      language - The user's language to set
    • getAvailableLocales

      @NotNull default @NotNull Locale[] getAvailableLocales()
      Returns the languages supported by the application.
      Returns:
      The languages supported by the application
    • getI18nResources

      @NotNull default @NotNull I18nResources getI18nResources()
      Returns the default I18N resources of the application.
      Returns:
      The default I18N resources
    • getI18nResources

      @NotNull default @NotNull I18nResources getI18nResources(String key)
      Returns the I18N resources identified by the specified key. If key is null or no resources is associated for such key returns the default I18N resources.
      Parameters:
      key - The key of the alternative I18N resources
      Returns:
      The I18N resources to use for the key