Package dev.satyrn.papermc.api.lang.v1
Class I18n.Utf8LangFileControl
java.lang.Object
java.util.ResourceBundle.Control
dev.satyrn.papermc.api.lang.v1.I18n.Utf8LangFileControl
- Enclosing class:
- I18n
Gathers a UTF-8 *.lang file into a resource bundle.
- Since:
- 1.1.0
-
Field Summary
Fields inherited from class java.util.ResourceBundle.Control
FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ResourceBundle
newBundle
(@NotNull String baseName, @NotNull Locale locale, @Nullable String format, @NotNull ClassLoader classLoader, boolean reload) Creates a new bundle from the *.lang file.@NotNull String
toBundleName
(@NotNull String baseName, @NotNull Locale locale) Gets the bundle name of this resource.Methods inherited from class java.util.ResourceBundle.Control
getCandidateLocales, getControl, getFallbackLocale, getFormats, getNoFallbackControl, getTimeToLive, needsReload, toResourceName
-
Constructor Details
-
Utf8LangFileControl
public Utf8LangFileControl()
-
-
Method Details
-
newBundle
@Nullable public @Nullable ResourceBundle newBundle(@NotNull @NotNull String baseName, @NotNull @NotNull Locale locale, @Nullable @Nullable String format, @NotNull @NotNull ClassLoader classLoader, boolean reload) throws IOException Creates a new bundle from the *.lang file.- Overrides:
newBundle
in classResourceBundle.Control
- Parameters:
baseName
- The base name of the file.locale
- The locale to use.format
- The file format. Unused.classLoader
- The java class loader instance.reload
- Whether the stream should be reloaded or the cached class loader stream should be used.- Returns:
- A new ResourceBundle from the language file.
- Throws:
IOException
- Occurs when the bundle file cannot be located or read.- Since:
- 1.1.0
-
toBundleName
@NotNull public @NotNull String toBundleName(@NotNull @NotNull String baseName, @NotNull @NotNull Locale locale) Gets the bundle name of this resource.- Overrides:
toBundleName
in classResourceBundle.Control
- Parameters:
baseName
- The fallback resource name if the locale does not have a language code.locale
- The locale.- Returns:
- The locale's language and country code separated by an underscore, or, if the locale lacks a language code, returns the base name.
- Since:
- 1.1.0
-