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.String
getCachedTranslation(Language sLang, Language tLang, java.lang.String text)
Get cached translation.java.lang.String
getTranslation(Language sLang, Language tLang, java.lang.String text)
Translate.boolean
isEnabled()
Determine whether or not the MT provider has been enabled by the user.void
setEnabled(boolean enabled)
Turn the MT provider on or offvoid
setGlossarySupplier(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:
isEnabled
in interfaceIMachineTranslation
-
setEnabled
public void setEnabled(boolean enabled)
Turn the MT provider on or off- Specified by:
setEnabled
in 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:
setGlossarySupplier
in interfaceIMachineTranslation
-
getTranslation
public java.lang.String getTranslation(Language sLang, Language tLang, java.lang.String text) throws java.lang.Exception
Translate.- Specified by:
getTranslation
in 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:
getCachedTranslation
in interfaceIMachineTranslation
- Parameters:
sLang
- source languagetLang
- target languagetext
- text for translation- Returns:
- translated text, or null if translation impossible
-
-