Class XLIFFFilter

  • All Implemented Interfaces:
    IFilter

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

      • XLIFFFilter

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

      • loadPlugins

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

        public static void unloadPlugins()
      • 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
      • 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 java.util.Map<java.lang.String,​java.lang.String> changeOptions​(java.awt.Window parent,
                                                                                    java.util.Map<java.lang.String,​java.lang.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​(java.io.File inFile,
                                       java.util.Map<java.lang.String,​java.lang.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​(java.lang.String path,
                             org.xml.sax.Attributes atts)
        Support of group and trans-unit resname attribute and trans-unit as comment, based on ResXFilter code
        Overrides:
        tagStart in class XMLFilter
      • tagEnd

        public void tagEnd​(java.lang.String path)
        Overrides:
        tagEnd in class XMLFilter
      • text

        public void text​(java.lang.String text)
        Overrides:
        text in class XMLFilter
      • translate

        public java.lang.String translate​(java.lang.String entry,
                                          java.util.List<ProtectedPart> protectedParts)
        The method the Handler would call to pass translatable content to OmegaT core and receive translation.
        Overrides:
        translate in class XMLFilter
      • isEnabledInDefault

        public boolean isEnabledInDefault()
        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.