Package net.kyori.adventure.translation
Interface Translator
-
- All Known Subinterfaces:
GlobalTranslator
,TranslationRegistry
public interface Translator
A message format translator.To see how to create a
Translator
with aResourceBundle
seeTranslationRegistry.registerAll(Locale, ResourceBundle, boolean)
After creating a
Translator
you can add it to theGlobalTranslator
to 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 @NotNull Key
name()
A key identifying this translation source.static @Nullable Locale
parseLocale(@NotNull String string)
@Nullable MessageFormat
translate(@NotNull String key, @NotNull Locale locale)
Gets a message format from a key and locale.
-
-
-
Method Detail
-
parseLocale
@Nullable static @Nullable Locale parseLocale(@NotNull @NotNull String string)
- Parameters:
string
- the string- Returns:
- a locale
- Since:
- 4.0.0
-
name
@NotNull @NotNull 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 @Nullable MessageFormat translate(@NotNull @NotNull String key, @NotNull @NotNull Locale locale)
Gets a message format from a key and locale.- Parameters:
locale
- a localekey
- a translation key- Returns:
- a message format or
null
to skip translation - Since:
- 4.0.0
-
-