Class BaseTranslate
- java.lang.Object
-
- org.omegat.core.machinetranslators.BaseTranslate
-
- All Implemented Interfaces:
IMachineTranslation
- Direct Known Subclasses:
BaseCachedTranslate
public abstract class BaseTranslate extends java.lang.Object implements IMachineTranslation
Base class for machine translation.
-
-
Constructor Summary
Constructors Constructor Description BaseTranslate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCachedTranslation(Language sLang, Language tLang, java.lang.String text)Get cached translation.java.lang.StringgetTranslation(Language sLang, Language tLang, java.lang.String text)Translate.booleanisEnabled()Determine whether or not the MT provider has been enabled by the user.voidsetEnabled(boolean enabled)Turn the MT provider on or offvoidsetGlossarySupplier(IMTGlossarySupplier glossarySupplier)Set a glossary supplier to provide relevant glossary terms if desired.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.omegat.gui.exttrans.IMachineTranslation
getName, isConfigurable, showConfigurationUI
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Determine whether or not the MT provider has been enabled by the user.- Specified by:
isEnabledin interfaceIMachineTranslation
-
setEnabled
public void setEnabled(boolean enabled)
Turn the MT provider on or off- Specified by:
setEnabledin interfaceIMachineTranslation
-
setGlossarySupplier
public void setGlossarySupplier(IMTGlossarySupplier glossarySupplier)
Set a glossary supplier to provide relevant glossary terms if desired. The terms are provided as a map with keys being the source terms and values being the target terms.- Specified by:
setGlossarySupplierin interfaceIMachineTranslation
-
getTranslation
public java.lang.String getTranslation(Language sLang, Language tLang, java.lang.String text) throws java.lang.Exception
Translate.- Specified by:
getTranslationin interfaceIMachineTranslation- Parameters:
sLang- source languagetLang- target languagetext- text for translation- Returns:
- translated text, or null if translation impossible
- Throws:
java.lang.Exception
-
getCachedTranslation
public java.lang.String getCachedTranslation(Language sLang, Language tLang, java.lang.String text)
Get cached translation. Returns null if translation not present.- Specified by:
getCachedTranslationin interfaceIMachineTranslation- Parameters:
sLang- source languagetLang- target languagetext- text for translation- Returns:
- translated text, or null if translation impossible
-
-