Class Translation

java.lang.Object
com.iizix.translate.Translation

public class Translation extends Object
Translation class holding the information processed by the translation engine.
Author:
Christopher Mindus
  • Field Details

    • originalText

      public final String originalText
      The original text as passed in to the translator.
    • originalLangID

      public final String originalLangID
      The original language ID. If no language is set on translation request, this member will contain what the Translator detected as language. This member may be null when the translation failed.
    • translatedText

      public final String translatedText
      The translated text, null for failure.
    • translationLangID

      public final String translationLangID
      The translation language ID.
    • sourceText

      public final KString sourceText
      The KString as the source text.
    • translator

      public final ITranslator translator
      The translator that provided the translation.
    • success

      public final boolean success
      Success flag: the members translatedText, translationLangID can be used (not null).
    • exception

      public final Throwable exception
      Exception for failure, null otherwise.
  • Constructor Details

    • Translation

      public Translation(ITranslator translator, KString sourceText, String originalText, String originalLangID, String translatedText, String translationLangID)
      Constructs the successful Translation.
      Parameters:
      translator - The translator.
      sourceText - The KString source text.
      originalText - The original text as passed in to the translator.
      originalLangID - The original language. If no language is set on translation request, this member will contain what the translation engine detected as language.
      translatedText - The translated text.
      translationLangID - The translation language.
    • Translation

      public Translation(ITranslator translator, KString sourceText, String originalText, String originalLangID, String translationLangID, Throwable exception)
      Constructs the failed Translation, only from the engine itself.
      Parameters:
      translator - The translator.
      sourceText - The KString source text.
      originalText - The original text as passed in to the translator.
      originalLangID - The original language. If no language is set on translation request, this member will contain what the translation engine detected as language, null if this failed.
      translationLangID - The translation language.
      exception - The exception.
  • Method Details

    • toString

      public String toString()
      The string representation of this class.
      Overrides:
      toString in class Object
    • getTranslatorName

      public String getTranslatorName()
      Gets the name of the translator.