Package com.iizigo.translate
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 Summary- Fields - Modifier and Type - Field - Description - static java.lang.String- TRANSLATORS_KEYThe preference store for translator engines, comma separated value with classes.- Fields inherited from class com.iizix.translate.TranslationEngine- DEBUG, ENCODING, ENCODING_NAME
 - Fields inherited from interface com.iizix.translate.ITranslationEngine- REQTYPE_POST, REQTYPE_POST_OVERRIDES_GET
 
 - Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - static void- configure(org.eclipse.swt.widgets.Shell shell)Configures the translation engine.- void- configureProxy(java.net.HttpURLConnection urlConnection)Configures a Http(s)URLConnection for proxy information.- java.net.Proxy- getProxy(java.net.URL url)Gets a proxy to use for an URL.- java.lang.String- getReadyState()Gets the ready state of this translation engine.- ITranslator- getTranslator(java.lang.String sourceLanguageCode, java.lang.String targetLanguageCode)Gets the translator to use for a particular language combination.- static void- initialize()Initializer.- boolean- isLanguageHandled(java.lang.String languageCode)Verifies if a Language Code is handled by this translator.- protected TranslationQueue- newTranslationQueue(java.lang.String sourceLanguageCode, java.lang.String targetLanguageCode, ITranslator translator)Creates a new TranslationQueue instance.- Methods inherited from class com.iizix.translate.TranslationEngine- cancel, canTranslate, clearLanguageQueue, getInstance, getQueues, postRequestJSON, requestJSON, requestJSON, requestString, requestString, translate
 
 
- Field Detail- TRANSLATORS_KEY- public static final java.lang.String TRANSLATORS_KEY The preference store for translator engines, comma separated value with classes.- See Also:
- Constant Field Values
 
 
 - Method Detail- initialize- public static void initialize() Initializer.
 - configure- public static void configure(org.eclipse.swt.widgets.Shell shell) Configures the translation engine.- Parameters:
- shell- The shell.
 
 - newTranslationQueue- protected TranslationQueue newTranslationQueue(java.lang.String sourceLanguageCode, java.lang.String targetLanguageCode, ITranslator translator) Creates a new TranslationQueue instance.- Specified by:
- newTranslationQueuein class- TranslationEngine
- Parameters:
- sourceLanguageCode- The source language code, null for auto-detect.
- targetLanguageCode- The target language code.
- translator- The translator.
 
 - getTranslator- public ITranslator getTranslator(java.lang.String sourceLanguageCode, java.lang.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- public java.lang.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- public boolean isLanguageHandled(java.lang.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- public java.net.Proxy getProxy(java.net.URL url) Gets a proxy to use for an URL.- Parameters:
- url- The URL.
- Returns:
- The Proxy to use.
 
 - configureProxy- public void configureProxy(java.net.HttpURLConnection urlConnection) Configures a Http(s)URLConnection for proxy information.- Parameters:
- urlConnection- The HttpURLConnection or HttpsURLConnection.