Package dev.orne.i18n

Class I18N

java.lang.Object
dev.orne.i18n.I18N

@API(status=STABLE, since="0.1") public final class I18N extends Object
Main entry point to I18N framework. Provides methods for configuration and manipulation of I18N contexts.
Since:
0.1
Version:
1.0, 2021-01
Author:
(w) Iker Hernaez
See Also:
  • Method Details

    • getAvailableLocales

      @NotNull public static @NotNull Locale[] getAvailableLocales()
      Returns the languages supported by the application.

      Shortcut for I18nContext.getInstance().getAvailableLocales().

      Returns:
      The languages supported by the application
      See Also:
    • getResources

      @NotNull public static @NotNull I18nResources getResources()
      Returns the default I18N resources of the application.

      Shortcut for I18nContext.getInstance().getI18nResources().

      Returns:
      The default I18N resources
      See Also:
    • getResources

      @NotNull public static @NotNull I18nResources getResources(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.

      Shortcut for I18nContext.getInstance().getI18nResources(key).

      Parameters:
      key - The key of the alternative I18N resources
      Returns:
      The I18N resources to use for the key
      See Also:
    • getLocale

      @NotNull public static @NotNull Locale getLocale()
      Returns the current locale.
      Returns:
      The current locale
    • setLocale

      public static void setLocale(Locale locale)
      Sets the current locale.
      Parameters:
      locale - The current locale