Interface Translator

All Known Implementing Classes:
AndroidFilter, CamtasiaWindowsFilter, DocBookFilter, FlashFilter, HelpAndManualFilter, InfixFilter, L10nmgrFilter, OpenDocXMLFilter, OpenXMLXMLFilter, PropertiesFilter, RelaxNGFilter, ResXFilter, SchematronFilter, ScribusFilter, SvgFilter, TXMLFilter, Typo3Filter, VisioFilter, WiXFilter, WordpressFilter, XHTMLFilter, XLIFFFilter, XMLFilter, XMLSpreadsheetFilter

public interface Translator
The interface to specify the method a Handler can use to translate text.
  • Method Details

    • translate

      String translate(String s, @Nullable @Nullable List<ProtectedPart> protectedParts)
      The method the Handler would call to pass translatable content to OmegaT core and receive translation.
    • createReader

      BufferedReader createReader(File inFile, String inEncoding) throws UnsupportedEncodingException, IOException
      Creates a special XML-encoding-aware reader of an input file.
      Parameters:
      inFile - The source file.
      inEncoding - Encoding of the source file, if the filter supports it. Otherwise, it should be null.
      Returns:
      The reader of the source file.
      Throws:
      UnsupportedEncodingException - Thrown if JVM doesn't support the specified inEncoding.
      IOException - If I/O Error occurs upon reader creation.
    • createWriter

      BufferedWriter createWriter(@Nullable @Nullable File outFile, String outEncoding) throws UnsupportedEncodingException, IOException
      Creates a writer of the translated file.
      Parameters:
      outFile - The target file.
      outEncoding - Encoding of the target file, if the filter supports it. Otherwise, it should be null.
      Returns:
      The writer for the target file.
      Throws:
      UnsupportedEncodingException - Thrown if JVM doesn't support the specified outEncoding
      IOException - If any I/O Error occurs upon writer creation
    • tagStart

      void tagStart(String path, @Nullable @Nullable Attributes atts)
      Start tag translation.
      Parameters:
      path - path in the XML
      atts - attributes
    • tagEnd

      void tagEnd(String path)
      Finish tag translation.
      Parameters:
      path - path in the XML
    • comment

      void comment(String comment)
      Process comment.
    • text

      void text(String text)
      Process text.
    • isInIgnored

      boolean isInIgnored()
      Returns true if the current section should be ignored by parser.
    • getTargetLanguage

      @Nullable @Nullable Language getTargetLanguage()
    • getSourceLanguage

      @Nullable @Nullable Language getSourceLanguage()