Package net.kyori.adventure.translation
Interface TranslationStore.StringBased<T>
- Type Parameters:
T
- the type of the translation
- All Superinterfaces:
TranslationStore<T>
,Translator
- All Known Subinterfaces:
TranslationRegistry
- All Known Implementing Classes:
AbstractTranslationStore.StringBased
- Enclosing interface:
- TranslationStore<T>
An abstract, string-based translation store.
This class extends upon the standard abstract translation store by adding support for reading from resource bundles.
- Since:
- 4.20.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.translation.TranslationStore
TranslationStore.StringBased<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
registerAll
(@NotNull Locale locale, @NotNull Path path, boolean escapeSingleQuotes) Registers a resource bundle of translations.void
registerAll
(@NotNull Locale locale, @NotNull ResourceBundle bundle, boolean escapeSingleQuotes) Registers a resource bundle of translations.Methods inherited from interface net.kyori.adventure.translation.TranslationStore
canTranslate, contains, contains, defaultLocale, register, registerAll, registerAll, unregister
Methods inherited from interface net.kyori.adventure.translation.Translator
hasAnyTranslations, name, translate, translate
-
Method Details
-
registerAll
void registerAll(@NotNull @NotNull Locale locale, @NotNull @NotNull Path path, boolean escapeSingleQuotes) Registers a resource bundle of translations.- Parameters:
locale
- a localepath
- a path to the resource bundleescapeSingleQuotes
- whether to escape single quotes- Throws:
IllegalArgumentException
- if a translation key already exists- Since:
- 4.20.0
- See Also:
-
registerAll
void registerAll(@NotNull @NotNull Locale locale, @NotNull @NotNull ResourceBundle bundle, boolean escapeSingleQuotes) Registers a resource bundle of translations.It is highly recommended to create your bundle using
UTF8ResourceBundleControl
as your bundle control for UTF-8 support - for example:final TranslationStore store = ...; final ResourceBundle bundle = ResourceBundle.getBundle("my_bundle", Locale.GERMANY, UTF8ResourceBundleControl.get()); store.registerAll(Locale.GERMANY, bundle, false);
- Parameters:
locale
- a localebundle
- a resource bundleescapeSingleQuotes
- whether to escape single quotes- Throws:
IllegalArgumentException
- if a translation key already exists- Since:
- 4.20.0
- See Also:
-