Interface TranslationStore


public interface TranslationStore
Renders translatable components into a given locale.

A single store is active at a time, reachable statically through current() or from Server.translationStore().

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the active translation store implementation.
    static Locale
    Gets the default locale of the current translation store.
    Returns the locale used when a translation is missing in the requested one.
    void
    Loads the translations; called when the store becomes active.
    static Component
    render(Component component, Locale locale)
    Renders a component using a locale.
    renderComponent(Component component, Locale locale)
    Renders a component, translating every translatable part into a locale.
    static void
    Replaces the active translation store implementation, loading it and unloading the previous one.
    void
    Releases the translations; called when another store replaces this one.
  • Method Details

    • setStore

      static void setStore(TranslationStore store)
      Replaces the active translation store implementation, loading it and unloading the previous one.
      Parameters:
      store - new TranslationStore
    • current

      static TranslationStore current()
      Gets the active translation store implementation.
      Returns:
      active TranslationStore
    • render

      static Component render(Component component, Locale locale)
      Renders a component using a locale.
      Parameters:
      component - Component to render
      locale - Locale to render with
      Returns:
      rendered Component
    • defaultLocale

      static Locale defaultLocale()
      Gets the default locale of the current translation store.
      Returns:
      default Locale
    • renderComponent

      Component renderComponent(Component component, Locale locale)
      Renders a component, translating every translatable part into a locale.
      Parameters:
      component - the component to render
      locale - the target locale
      Returns:
      the rendered component
      Since:
      0.1.0
    • getDefaultLocale

      Locale getDefaultLocale()
      Returns the locale used when a translation is missing in the requested one.
      Returns:
      the locale used when a translation is missing in the requested one
      Since:
      0.1.0
    • load

      void load()
      Loads the translations; called when the store becomes active.
      Since:
      0.1.0
    • unload

      void unload()
      Releases the translations; called when another store replaces this one.
      Since:
      0.1.0