Interface GlobalTranslator

All Superinterfaces:
Translator

public interface GlobalTranslator extends Translator
A global source of translations. The global source is the default source used by adventure platforms when rendering a TranslatableComponent to an Audience.

To add your translations to this source, use GlobalTranslator#get()#addSource(Translator) with a TranslationStore or your own implementation of a Translator.

Since:
4.0.0
  • Method Details

    • translator

      static GlobalTranslator translator()
      Gets the global translation source.
      Returns:
      the source
      Since:
      4.10.0
    • renderer

      Gets a renderer which uses the global source for translating.
      Returns:
      a renderer
      Since:
      4.0.0
    • render

      static Component render(Component component, Locale locale)
      Renders a component using the global renderer.
      Parameters:
      component - the component to render
      locale - the locale to use when rendering
      Returns:
      the rendered component
      Since:
      4.0.0
    • sources

      Iterable<? extends Translator> sources()
      Gets the sources.
      Returns:
      the sources
      Since:
      4.0.0
    • addSource

      boolean addSource(Translator source)
      Adds a translation source.

      Duplicate sources will be ignored.

      Parameters:
      source - the source
      Returns:
      true if registered, false otherwise
      Throws:
      IllegalArgumentException - if source is GlobalTranslator
      Since:
      4.0.0
    • removeSource

      boolean removeSource(Translator source)
      Removes a translation source.
      Parameters:
      source - the source to unregister
      Returns:
      true if unregistered, false otherwise
      Since:
      4.0.0