Package org.daisy.dotify.translator
Class SimpleBrailleTranslator
- java.lang.Object
-
- org.daisy.dotify.translator.SimpleBrailleTranslator
-
- All Implemented Interfaces:
BrailleTranslator
public class SimpleBrailleTranslator extends Object implements BrailleTranslator
Provides a simple braille translator that translates all texts using the same filter, regardless of language. The translator does however switch hyphenation rules based on language and it will throw an exception if it cannot find the appropriate hyphenation rules for the language.
-
-
Constructor Summary
Constructors Constructor Description SimpleBrailleTranslator(BrailleFilter filter, String translatorMode)
Creates a new simple braille translator.SimpleBrailleTranslator(BrailleFilter filter, BrailleFinalizer finalizer, String translatorMode)
Creates a new simple braille translator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getTranslatorMode()
Gets the translator mode of this translator.BrailleTranslatorResult
translate(Translatable specification)
Translates a text into braille using the supplied specification.BrailleTranslatorResult
translate(TranslatableWithContext specification)
Translates a text into braille using the supplied specification.
-
-
-
Constructor Detail
-
SimpleBrailleTranslator
public SimpleBrailleTranslator(BrailleFilter filter, String translatorMode)
Creates a new simple braille translator.- Parameters:
filter
- the braille filter to usetranslatorMode
- the translator mode
-
SimpleBrailleTranslator
public SimpleBrailleTranslator(BrailleFilter filter, BrailleFinalizer finalizer, String translatorMode)
Creates a new simple braille translator.- Parameters:
filter
- the braille filter to usefinalizer
- the braille finalizer to usetranslatorMode
- the translator mode
-
-
Method Detail
-
translate
public BrailleTranslatorResult translate(Translatable specification) throws TranslationException
Description copied from interface:BrailleTranslator
Translates a text into braille using the supplied specification.- Specified by:
translate
in interfaceBrailleTranslator
- Parameters:
specification
- the specification- Returns:
- a translator result
- Throws:
TranslationException
- if the locale is not supported by the implementation
-
translate
public BrailleTranslatorResult translate(TranslatableWithContext specification) throws TranslationException
Description copied from interface:BrailleTranslator
Translates a text into braille using the supplied specification.- Specified by:
translate
in interfaceBrailleTranslator
- Parameters:
specification
- the specification- Returns:
- a translator result
- Throws:
TranslationException
- if the locale is not supported by the implementation
-
getTranslatorMode
public String getTranslatorMode()
Description copied from interface:BrailleTranslator
Gets the translator mode of this translator.- Specified by:
getTranslatorMode
in interfaceBrailleTranslator
- Returns:
- returns the translator mode
-
-