Class BaseTranslator
java.lang.Object
com.guflimc.brick.i18n.api.translator.BaseTranslator
- Direct Known Subclasses:
ExtendedTranslator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Localeprotected final Stringprotected final net.kyori.adventure.translation.TranslationRegistryprotected final StandardComponentRenderer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal net.kyori.adventure.text.Componentcenter(int width, net.kyori.adventure.text.Component component) final net.kyori.adventure.text.Componentcenter(net.kyori.adventure.text.Component component) final net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componenthoverable(net.kyori.adventure.audience.Audience audience, @NotNull String msgKey, @NotNull String hoverKey) final Stringid()final voidimportTranslations(URL resource) final voidimportTranslations(URL resource, Locale locale) final voidimportTranslations(Path path) final net.kyori.adventure.text.ComponentmaybeTranslate(Locale locale, net.kyori.adventure.text.Component component) Translates the component if the given parameter is aTranslatableComponent.final net.kyori.adventure.text.ComponentmaybeTranslate(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component component) final voidmenu(net.kyori.adventure.audience.Audience audience, char borderShape, net.kyori.adventure.text.format.TextColor borderColor, net.kyori.adventure.text.Component... components) final voidmenu(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component... components) final net.kyori.adventure.text.ComponentpaddingAround(int width, net.kyori.adventure.text.Component... components) final net.kyori.adventure.text.ComponentpaddingAround(net.kyori.adventure.text.Component... components) final voidfinal voidfinal voidsend(net.kyori.adventure.audience.Audience audience, String key, net.kyori.adventure.text.Component... args) voidsend(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.TranslatableComponent component) protected final net.kyori.adventure.text.TranslatableComponenttranslatable(String key, Object... args) protected final net.kyori.adventure.text.TranslatableComponenttranslatable(String key, net.kyori.adventure.text.Component... args) final net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componenttranslate(Locale locale, Duration duration, DurationFormatter formatter) This will replace the following time placeholders with their respective translation: Y - time.year M - time.month D - time.day h - time.hour m - time.minute s - time.secondfinal net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componenttranslate(net.kyori.adventure.audience.Audience audience, String key, net.kyori.adventure.text.Component... args) final net.kyori.adventure.text.Componentfinal net.kyori.adventure.text.Componenttranslate(net.kyori.adventure.audience.Audience audience, Duration duration, DurationFormatter formatter) final net.kyori.adventure.text.Componenttranslate(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.TranslatableComponent component) final intwidth(net.kyori.adventure.text.Component component)
-
Field Details
-
registry
protected final net.kyori.adventure.translation.TranslationRegistry registry -
defaultLocale
-
id
-
renderer
-
-
Constructor Details
-
BaseTranslator
-
-
Method Details
-
id
-
translate
public final net.kyori.adventure.text.Component translate(Locale locale, net.kyori.adventure.text.TranslatableComponent component) -
translate
-
translate
-
translate
-
translate
public final net.kyori.adventure.text.Component translate(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.TranslatableComponent component) -
translate
public final net.kyori.adventure.text.Component translate(net.kyori.adventure.audience.Audience audience, String key) -
translate
-
translate
public final net.kyori.adventure.text.Component translate(net.kyori.adventure.audience.Audience audience, String key, net.kyori.adventure.text.Component... args) -
send
public void send(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.TranslatableComponent component) -
send
-
send
-
send
public final void send(net.kyori.adventure.audience.Audience audience, String key, net.kyori.adventure.text.Component... args) -
translatable
-
translatable
protected final net.kyori.adventure.text.TranslatableComponent translatable(String key, net.kyori.adventure.text.Component... args) -
hoverable
-
hoverable
-
paddingAround
public final net.kyori.adventure.text.Component paddingAround(net.kyori.adventure.text.Component... components) -
paddingAround
public final net.kyori.adventure.text.Component paddingAround(int width, net.kyori.adventure.text.Component... components) -
center
public final net.kyori.adventure.text.Component center(net.kyori.adventure.text.Component component) -
center
public final net.kyori.adventure.text.Component center(int width, net.kyori.adventure.text.Component component) -
width
public final int width(net.kyori.adventure.text.Component component) -
translate
public final net.kyori.adventure.text.Component translate(Locale locale, Duration duration, DurationFormatter formatter) This will replace the following time placeholders with their respective translation:- Y - time.year
- M - time.month
- D - time.day
- h - time.hour
- m - time.minute
- s - time.second
- Parameters:
locale- the locale to useduration- the duration to formatformatter- the formatter to use- Returns:
- the translated and formatted duration
-
translate
-
translate
public final net.kyori.adventure.text.Component translate(net.kyori.adventure.audience.Audience audience, Duration duration, DurationFormatter formatter) -
translate
public final net.kyori.adventure.text.Component translate(net.kyori.adventure.audience.Audience audience, Duration duration) -
maybeTranslate
public final net.kyori.adventure.text.Component maybeTranslate(Locale locale, net.kyori.adventure.text.Component component) Translates the component if the given parameter is aTranslatableComponent. Otherwise, this method will search the text of the given component and replace any keys that are found with its translation. It will then return the resulting component. If no keys are found, this will exactly return the given component.- Parameters:
locale- the locale to use for translationcomponent- the component to translate- Returns:
- the translated component
-
maybeTranslate
public final net.kyori.adventure.text.Component maybeTranslate(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component component) -
importTranslations
- Throws:
MalformedURLException
-
importTranslations
-
importTranslations
-