Class TranslatableProvider

  • All Implemented Interfaces:
    net.kyori.adventure.text.ComponentLike

    public final class TranslatableProvider
    extends Object
    implements net.kyori.adventure.text.ComponentLike
    A typesafe provider for translatable messages.

    Designed for use from generated code containing translation keys.

    Since:
    2.0.0
    • Method Detail

      • key

        public String key()
        The translation key used for lookup.
        Returns:
        the translation key
        Since:
        2.0.0
      • tr

        public net.kyori.adventure.text.TranslatableComponent tr​(Object... args)
        Create a translatable component with the provided arguments.
        Parameters:
        args - the arguments
        Returns:
        a new translatable component
        Since:
        2.0.0
      • bTr

        public net.kyori.adventure.text.TranslatableComponent.Builder bTr​(Object... args)
        Create a translatable component builder configured with the provided arguments.
        Parameters:
        args - the arguments
        Returns:
        a new builder
        Since:
        2.0.0
      • asComponent

        public @NonNull net.kyori.adventure.text.Component asComponent()

        This will create a component without any arguments.

        Specified by:
        asComponent in interface net.kyori.adventure.text.ComponentLike
      • knownLocales

        public static Stream<LocaleknownLocales​(Class<?> loaderOf,
                                                  String bundleName)
        Get known locales for a certain bundle name.
        Parameters:
        loaderOf - The class to use to determine a code source
        bundleName - the name of the bundle to find languages of
        Returns:
        the known locales