Class XLIFFDialect

java.lang.Object
org.omegat.filters3.xml.DefaultXMLDialect
org.omegat.filters3.xml.xliff.XLIFFDialect
All Implemented Interfaces:
XMLDialect

public class XLIFFDialect extends DefaultXMLDialect
This class specifies XLIFF XML Dialect.

XLIFF 1.2 specification

  • Constructor Details

    • XLIFFDialect

      public XLIFFDialect()
  • Method Details

    • defineDialect

      public void defineDialect(XLIFFOptions options)
      Actually defines the dialect. It cannot be done during creation, because options are not known at that step.
    • validatePreformatTag

      public Boolean validatePreformatTag(String tag, @Nullable Attributes atts)
      In the XLIFF filter, the tag <mrk> is a preformat tag when the attribute "mtype" contains "seg".
      Specified by:
      validatePreformatTag in interface XMLDialect
      Overrides:
      validatePreformatTag in class DefaultXMLDialect
      Parameters:
      tag - An XML tag
      atts - The attributes associated with the tag
      Returns:
      true if this tag should be a preformat tag, false otherwise
    • validateIntactTag

      public Boolean validateIntactTag(String tag, @Nullable Attributes atts)
      In the XLKIFF filter, content shouldn't be translated if translate="no" translate attribute
      Specified by:
      validateIntactTag in interface XMLDialect
      Overrides:
      validateIntactTag in class DefaultXMLDialect
      Parameters:
      tag - An XML tag
      atts - The attributes associated with the tag
      Returns:
      false if the content of this tag should be translated, true otherwise
    • validateContentBasedTag

      public Boolean validateContentBasedTag(String tag, @Nullable Attributes atts)
      Description copied from interface: XMLDialect
      For a given tag, return wether the content of this tag should be translated, depending on the content of one attribute and the presence or absence of other attributes.
      Specified by:
      validateContentBasedTag in interface XMLDialect
      Overrides:
      validateContentBasedTag in class DefaultXMLDialect
      Parameters:
      tag - The tag that could be translated
      atts - The list of the tag attributes
      Returns:
      true or false
    • handleXMLTag

      public void handleXMLTag(XMLTag tag, boolean translated)
      Handle <target state="..."> attribute according to filter settings.
      Specified by:
      handleXMLTag in interface XMLDialect
      Overrides:
      handleXMLTag in class DefaultXMLDialect
      Parameters:
      tag - XML tag to be processed.
      translated - is the value considered translated?
      See Also:
    • constructShortcuts

      public String constructShortcuts(List<Element> elements, List<ProtectedPart> protectedParts)
      Description copied from interface: XMLDialect
      Returns shortcut string representation of the entry source. This is what the user translates. E.g. for Here's <b>bold text</b> should return Here's <b0>bold text</b0>.
      Specified by:
      constructShortcuts in interface XMLDialect
      Overrides:
      constructShortcuts in class DefaultXMLDialect