Interface TranslationContext

All Superinterfaces:
LogContext

public interface TranslationContext extends LogContext
TranslationContext represents the context used in a Translator.translate(TranslationContext) translate(TranslationContext)}.

All information that is available for translation.

  • Method Details

    • getTargetLocale

      @NotNull Locale getTargetLocale()
      Gets the target locale for translation.
      Returns:
      The target locale
    • getSourceLocale

      Locale getSourceLocale()
      Gets the source locale of the text.
      Returns:
      The source locale, or null if no specific source locale is defined
    • getText

      @NotNull String getText()
      Gets the text to be translated.
      Returns:
      The text to translate
    • getLocalizationKey

      String getLocalizationKey()
      Gets the localization key for this translation.
      Returns:
      The localization key, or null if no specific key is defined
    • isInMemoryTranslation

      boolean isInMemoryTranslation()
      Determines if this is an in-memory translation that should not be persisted.
      Returns:
      true if this is an in-memory translation, false otherwise
    • isPersistentTranslation

      boolean isPersistentTranslation()
      Determines if this is a persistent translation that should be stored.
      Returns:
      true if this is a persistent translation, false otherwise
    • isCached

      default boolean isCached()
      Determines if this translation should be cached. A translation is cached if it is either an in-memory or a persistent translation.
      Returns:
      true if this translation should be cached, false otherwise