Class EditorTranslationEngine

java.lang.Object
com.iizix.translate.TranslationEngine
com.iizigo.translate.EditorTranslationEngine
All Implemented Interfaces:
ITranslationEngine

public class EditorTranslationEngine extends TranslationEngine
The translation engine: two current translators are provided: Google and Bing, but the interface allows others. This engine is built to provide support to use multiple translators in parallel, with its own language capabilities and this engine would select the most suitable one to use.
Author:
Christopher Mindus
  • Field Details Link icon

    • TRANSLATORS_KEY Link icon

      public static final String TRANSLATORS_KEY
      The preference store for translator engines, comma separated value with classes.
      See Also:
  • Method Details Link icon

    • initialize Link icon

      public static void initialize()
      Initializer.
    • configure Link icon

      public static void configure(Shell shell)
      Configures the translation engine.
      Parameters:
      shell - The shell.
    • newTranslationQueue Link icon

      protected TranslationQueue newTranslationQueue(String sourceLanguageCode, String targetLanguageCode, ITranslator translator)
      Creates a new TranslationQueue instance.
      Specified by:
      newTranslationQueue in class TranslationEngine
      Parameters:
      sourceLanguageCode - The source language code, null for auto-detect.
      targetLanguageCode - The target language code.
      translator - The translator.
    • getTranslator Link icon

      public ITranslator getTranslator(String sourceLanguageCode, String targetLanguageCode)
      Gets the translator to use for a particular language combination.
      Parameters:
      sourceLanguageCode - The source language code, null for automatic detection.
      targetLanguageCode - The target language code.
      Returns:
      The translator, null for not found or not configured.
    • getReadyState Link icon

      public String getReadyState()
      Gets the ready state of this translation engine.
      Returns:
      An error message describing the state (e.g. "Not configured"), or null for OK.
    • isLanguageHandled Link icon

      public boolean isLanguageHandled(String languageCode)
      Verifies if a Language Code is handled by this translator.
      Parameters:
      languageCode - The language code.
      Returns:
      true if supported, false if not.
    • getProxy Link icon

      public Proxy getProxy(URL url)
      Gets a proxy to use for an URL.
      Parameters:
      url - The URL.
      Returns:
      The Proxy to use.
    • configureProxy Link icon

      public void configureProxy(HttpURLConnection urlConnection)
      Configures a Http(s)URLConnection for proxy information.
      Parameters:
      urlConnection - The HttpURLConnection or HttpsURLConnection.