Package dev.satyrn.sowwhatyoureap.lang
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
ConstructorsConstructorDescriptionI18n(org.bukkit.plugin.Plugin plugin, Configuration configuration) Initializes a new I18n instance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()Disables the i18n handler.voidenable()Enables the i18n handler.protected @NotNull ResourceBundlegetResourceBundleForLocale(@NotNull Locale locale) Gets a resource bundle for the given locale.voidreloadConfiguration(@NotNull Configuration configuration) Reloads the configuration instance.static @NotNull StringTranslates a resource string to the current locale.Methods inherited from class dev.satyrn.papermc.api.lang.v1.I18n
getCurrentLocale, getPlugin, setLocale, translate
-
Constructor Details
-
I18n
Initializes a new I18n instance.- Parameters:
plugin- The parent plugin instance.
-
-
Method Details
-
reloadConfiguration
Reloads the configuration instance.- Specified by:
reloadConfigurationin interfacedev.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:
getResourceBundleForLocalein classdev.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:
enablein classdev.satyrn.papermc.api.lang.v1.I18n
-
disable
public void disable()Disables the i18n handler.- Specified by:
disablein classdev.satyrn.papermc.api.lang.v1.I18n
-