Class XLIFFFilter

All Implemented Interfaces:
IFilter, Translator

public class XLIFFFilter extends XMLFilter
Filter for XLIFF files.
  • Constructor Details

    • XLIFFFilter

      public XLIFFFilter()
      Creates a new instance of XLIFFFilter
  • Method Details

    • loadPlugins

      public static void loadPlugins()
      Register plugin into OmegaT.
    • unloadPlugins

      public static void unloadPlugins()
    • getFileFormatName

      public String getFileFormatName()
      Human-readable name of the File Format this filter supports.
      Specified by:
      getFileFormatName in interface IFilter
      Specified by:
      getFileFormatName in class AbstractFilter
      Returns:
      File format name
    • getDefaultInstances

      public Instance[] getDefaultInstances()
      The default list of filter instances that this filter class has. One filter class may have different filter instances, different by source file mask, encoding of the source file etc.

      Note that the user may change the instances freely.

      Specified by:
      getDefaultInstances in interface IFilter
      Specified by:
      getDefaultInstances in class AbstractFilter
      Returns:
      Default filter instances
    • isSourceEncodingVariable

      public boolean isSourceEncodingVariable()
      Either the encoding can be read, or it is UTF-8.
      Specified by:
      isSourceEncodingVariable in interface IFilter
      Overrides:
      isSourceEncodingVariable in class XMLFilter
      Returns:
      false
    • isTargetEncodingVariable

      public boolean isTargetEncodingVariable()
      Yes, XLIFF may be written out in a variety of encodings.
      Specified by:
      isTargetEncodingVariable in interface IFilter
      Overrides:
      isTargetEncodingVariable in class XMLFilter
      Returns:
      true
    • hasOptions

      public boolean hasOptions()
      Returns true to indicate that the XLIFF filter has options.
      Specified by:
      hasOptions in interface IFilter
      Overrides:
      hasOptions in class AbstractFilter
      Returns:
      True, because the XLIFF filter has options.
    • changeOptions

      public @Nullable Map<String,String> changeOptions(Window parent, Map<String,String> currentOptions)
      XLIFF Filter shows a modal dialog to edit its own options.
      Parameters:
      currentOptions - Current options to edit.
      parent - parent window
      Returns:
      Updated filter options if user confirmed the changes, and current options otherwise.
    • isFileSupported

      public boolean isFileSupported(File inFile, Map<String,String> config, FilterContext context)
      We're not actually checking whether it is a valid XLIFF file; we just need a place to call defineDialect.
      Specified by:
      isFileSupported in interface IFilter
      Overrides:
      isFileSupported in class AbstractFilter
      Parameters:
      inFile - Source file.
      config - filter's configuration options
      context - Filter context.
      Returns:
      Does the filter support the file.
    • tagStart

      public void tagStart(String path, @Nullable Attributes atts)
      Support of group and trans-unit resname attribute and trans-unit as comment, based on ResXFilter code
      Specified by:
      tagStart in interface Translator
      Overrides:
      tagStart in class XMLFilter
      Parameters:
      path - path in the XML
      atts - attributes
    • tagEnd

      public void tagEnd(String path)
      Description copied from interface: Translator
      Finish tag translation.
      Specified by:
      tagEnd in interface Translator
      Overrides:
      tagEnd in class XMLFilter
      Parameters:
      path - path in the XML
    • isInIgnored

      public boolean isInIgnored()
      Description copied from interface: Translator
      Returns true if the current section should be ignored by parser.
      Specified by:
      isInIgnored in interface Translator
      Overrides:
      isInIgnored in class XMLFilter
    • text

      public void text(@Nullable String newText)
      Description copied from interface: Translator
      Process text.
      Specified by:
      text in interface Translator
      Overrides:
      text in class XMLFilter
    • translate

      public String translate(String entry, @Nullable List<ProtectedPart> givenProtectedParts)
      Description copied from class: XMLFilter
      The method the Handler would call to pass translatable content to OmegaT core and receive translation.
      Specified by:
      translate in interface Translator
      Overrides:
      translate in class XMLFilter
    • isEnabledInDefault

      public boolean isEnabledInDefault()
      Description copied from interface: IFilter
      Is the filter enabled in default.

      Deprecated filter may be disabled in default. So it can override the method to return false;

      Returns:
      false when the filter is disabled in default.