Package net.kyori.adventure.translation
Interface GlobalTranslator
- 
- All Superinterfaces:
- net.kyori.examination.Examinable,- Translator
 
 public interface GlobalTranslator extends Translator, net.kyori.examination.Examinable A global source of translations. The global source is the default source used by adventure platforms when rendering aTranslatableComponentto anAudience.To add your translations to this source, use GlobalTranslator#get()#addSource(Translator)with aTranslationRegistryor your own implementation of aTranslator.- Since:
- 4.0.0
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleanaddSource(@NotNull Translator source)Adds a translation source.static @NotNull GlobalTranslatorget()Deprecated.for removal since 4.10.0, usetranslator()instead.booleanremoveSource(@NotNull Translator source)Removes a translation source.static @NotNull Componentrender(@NotNull Component component, @NotNull java.util.Locale locale)Renders a component using theglobal renderer.static @NotNull TranslatableComponentRenderer<java.util.Locale>renderer()Gets a renderer which uses the global source for translating.@NotNull java.lang.Iterable<? extends Translator>sources()Gets the sources.static @NotNull GlobalTranslatortranslator()Gets the global translation source.- 
Methods inherited from interface net.kyori.examination.ExaminableexaminableName, examinableProperties, examine
 - 
Methods inherited from interface net.kyori.adventure.translation.Translatorname, translate, translate
 
- 
 
- 
- 
- 
Method Detail- 
translator@NotNull static @NotNull GlobalTranslator translator() Gets the global translation source.- Returns:
- the source
- Since:
- 4.10.0
 
 - 
get@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull static @NotNull GlobalTranslator get() Deprecated.for removal since 4.10.0, usetranslator()instead.Gets the global translation source.- Returns:
- the source
- Since:
- 4.0.0
 
 - 
renderer@NotNull static @NotNull TranslatableComponentRenderer<java.util.Locale> renderer() Gets a renderer which uses the global source for translating.- Returns:
- a renderer
- Since:
- 4.0.0
 
 - 
render@NotNull static @NotNull Component render(@NotNull @NotNull Component component, @NotNull @NotNull java.util.Locale locale) Renders a component using theglobal renderer.- Parameters:
- component- the component to render
- locale- the locale to use when rendering
- Returns:
- the rendered component
- Since:
- 4.0.0
 
 - 
sources@NotNull @NotNull java.lang.Iterable<? extends Translator> sources() Gets the sources.- Returns:
- the sources
- Since:
- 4.0.0
 
 - 
addSourceboolean addSource(@NotNull @NotNull Translator source)Adds a translation source.Duplicate sources will be ignored. - Parameters:
- source- the source
- Returns:
- trueif registered,- falseotherwise
- Throws:
- java.lang.IllegalArgumentException- if source is- GlobalTranslator
- Since:
- 4.0.0
 
 - 
removeSourceboolean removeSource(@NotNull @NotNull Translator source)Removes a translation source.- Parameters:
- source- the source to unregister
- Returns:
- trueif unregistered,- falseotherwise
- Since:
- 4.0.0
 
 
- 
 
-