Class EmptyTranslator

  • All Implemented Interfaces:
    Translator

    public class EmptyTranslator
    extends java.lang.Object
    implements Translator
    Dummy translator that always declines to give any text. Useful as a sentinel translator for when none others are available. for unknown document types.
    • Constructor Summary

      Constructors 
      Constructor Description
      EmptyTranslator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isAvailable()  
      java.lang.String translate​(java.lang.String text, java.lang.String targetLanguage)
      Translate text to the given language This method attempts to auto-detect the source language of the text.
      java.lang.String translate​(java.lang.String text, java.lang.String sourceLanguage, java.lang.String targetLanguage)
      Translate text between given languages.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EmptyTranslator

        public EmptyTranslator()
    • Method Detail

      • translate

        public java.lang.String translate​(java.lang.String text,
                                          java.lang.String sourceLanguage,
                                          java.lang.String targetLanguage)
        Description copied from interface: Translator
        Translate text between given languages.
        Specified by:
        translate in interface Translator
        Parameters:
        text - The text to translate.
        sourceLanguage - The input text language (for example, "en").
        targetLanguage - The desired language to translate to (for example, "fr").
        Returns:
        The translation result. If translation is unavailable, returns the same text back.
      • translate

        public java.lang.String translate​(java.lang.String text,
                                          java.lang.String targetLanguage)
        Description copied from interface: Translator
        Translate text to the given language This method attempts to auto-detect the source language of the text.
        Specified by:
        translate in interface Translator
        Parameters:
        text - The text to translate.
        targetLanguage - The desired language to translate to (for example, "hi").
        Returns:
        The translation result. If translation is unavailable, returns the same text back.
      • isAvailable

        public boolean isAvailable()
        Specified by:
        isAvailable in interface Translator
        Returns:
        true if this Translator is probably able to translate right now.