Package net.kyori.adventure.translation
Interface Translator
-
- All Known Subinterfaces:
GlobalTranslator,TranslationRegistry
public interface TranslatorA message format translator.To see how to create a
Translatorwith aResourceBundleseeTranslationRegistry.registerAll(Locale, ResourceBundle, boolean)After creating a
Translatoryou can add it to theGlobalTranslatorto enable automatic translations by the platforms.- Since:
- 4.0.0
- See Also:
TranslationRegistry
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull net.kyori.adventure.key.Keyname()A key identifying this translation source.static @Nullable LocaleparseLocale(@NonNull String string)@Nullable MessageFormattranslate(@NonNull String key, @NonNull Locale locale)Gets a message format from a key and locale.
-
-
-
Method Detail
-
parseLocale
static @Nullable Locale parseLocale(@NonNull String string)
- Parameters:
string- the string- Returns:
- a locale
- Since:
- 4.0.0
-
name
@NonNull net.kyori.adventure.key.Key name()
A key identifying this translation source.Intended to be used for display to users.
- Returns:
- an identifier for this translation source
- Since:
- 4.0.0
-
translate
@Nullable MessageFormat translate(@NonNull String key, @NonNull Locale locale)
Gets a message format from a key and locale.- Parameters:
locale- a localekey- a translation key- Returns:
- a message format or
nullto skip translation - Since:
- 4.0.0
-
-