Class I18n

java.lang.Object
dev.satyrn.papermc.api.lang.v1.I18n
dev.satyrn.sowwhatyoureap.lang.I18n
All Implemented Interfaces:
dev.satyrn.papermc.api.configuration.v4.ConfigurationConsumer<Configuration>

public final class I18n extends dev.satyrn.papermc.api.lang.v1.I18n implements dev.satyrn.papermc.api.configuration.v4.ConfigurationConsumer<Configuration>
Message internationalization for the plugin
Since:
1.0-SNAPSHOT
Author:
Isabel Maskrey
  • Nested Class Summary

    Nested classes/interfaces inherited from class dev.satyrn.papermc.api.lang.v1.I18n

    dev.satyrn.papermc.api.lang.v1.I18n.Utf8LangFileControl
  • Field Summary

    Fields inherited from class dev.satyrn.papermc.api.lang.v1.I18n

    DEFAULT_LOCALE
  • Constructor Summary

    Constructors
    Constructor
    Description
    I18n(org.bukkit.plugin.Plugin plugin, Configuration configuration)
    Initializes a new I18n instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disables the i18n handler.
    void
    Enables the i18n handler.
    protected @NotNull ResourceBundle
    Gets a resource bundle for the given locale.
    void
    reloadConfiguration(@NotNull Configuration configuration)
    Reloads the configuration instance.
    static @NotNull String
    tr(@NotNull String key, @NotNull Object... format)
    Translates a resource string to the current locale.

    Methods inherited from class dev.satyrn.papermc.api.lang.v1.I18n

    getCurrentLocale, getPlugin, setLocale, translate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • I18n

      public I18n(org.bukkit.plugin.Plugin plugin, Configuration configuration)
      Initializes a new I18n instance.
      Parameters:
      plugin - The parent plugin instance.
  • Method Details

    • reloadConfiguration

      public void reloadConfiguration(@NotNull @NotNull Configuration configuration)
      Reloads the configuration instance.
      Specified by:
      reloadConfiguration in interface dev.satyrn.papermc.api.configuration.v4.ConfigurationConsumer<Configuration>
      Parameters:
      configuration - The configuration instance.
    • tr

      @NotNull public static @NotNull String tr(@NotNull @NotNull String key, @NotNull @NotNull Object... format)
      Translates a resource string to the current locale.
      Parameters:
      key - The translation key.
      format - The translation format.
      Returns:
      The translated message.
    • getResourceBundleForLocale

      @NotNull protected @NotNull ResourceBundle getResourceBundleForLocale(@NotNull @NotNull Locale locale)
      Gets a resource bundle for the given locale.
      Specified by:
      getResourceBundleForLocale in class dev.satyrn.papermc.api.lang.v1.I18n
      Parameters:
      locale - The current locale
      Returns:
      The resource bundle for the current locale.
    • enable

      public void enable()
      Enables the i18n handler.
      Specified by:
      enable in class dev.satyrn.papermc.api.lang.v1.I18n
    • disable

      public void disable()
      Disables the i18n handler.
      Specified by:
      disable in class dev.satyrn.papermc.api.lang.v1.I18n