Package org.omegat.filters3.xml.xliff
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: http://docs.oasis-open.org/xliff/xliff-core/xliff-core.html
-
-
Field Summary
-
Fields inherited from interface org.omegat.filters3.xml.XMLDialect
CONSTRAINT_DOCTYPE, CONSTRAINT_DOCTYPE_UNBOXED, CONSTRAINT_PUBLIC_DOCTYPE, CONSTRAINT_PUBLIC_DOCTYPE_UNBOXED, CONSTRAINT_ROOT, CONSTRAINT_ROOT_UNBOXED, CONSTRAINT_SYSTEM_DOCTYPE, CONSTRAINT_SYSTEM_DOCTYPE_UNBOXED, CONSTRAINT_XMLNS, CONSTRAINT_XMLNS_UNBOXED
-
-
Constructor Summary
Constructors Constructor Description XLIFFDialect()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
constructShortcuts(java.util.List<Element> elements, java.util.List<ProtectedPart> protectedParts)
Returns shortcut string representation of the entry source.void
defineDialect(XLIFFOptions options)
Actually defines the dialect.void
handleXMLTag(XMLTag tag, boolean translated)
Handle <target state="..."> attribute according to filter settings.java.lang.Boolean
validateContentBasedTag(java.lang.String tag, Attributes atts)
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.java.lang.Boolean
validateIntactTag(java.lang.String tag, Attributes atts)
In the XLKIFF filter, content shouldn't be translated if translate="no" http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#translatejava.lang.Boolean
validatePreformatTag(java.lang.String tag, Attributes atts)
In the XLIFF filter, the tag <mrk> is a preformat tag when the attribute "mtype" contains "seg".-
Methods inherited from class org.omegat.filters3.xml.DefaultXMLDialect
defineConstraint, defineContentBasedTag, defineIntactTag, defineIntactTags, defineOutOfTurnTag, defineOutOfTurnTags, defineParagraphTag, defineParagraphTags, definePreformatTag, definePreformatTags, defineShortcut, defineShortcuts, defineTranslatableAttribute, defineTranslatableAttributes, defineTranslatableTagAttribute, defineTranslatableTagAttributes, defineTranslatableTagsAttribute, getClosingTagRequired, getConstraints, getContentBasedTags, getForceSpacePreserving, getIntactTags, getOutOfTurnTags, getParagraphTags, getPreformatTags, getShortcuts, getTagsAggregationEnabled, getTranslatableAttributes, getTranslatableTagAttributes, resolveEntity, setClosingTagRequired, setForceSpacePreserving, setTagsAggregationEnabled, validateParagraphTag, validateTranslatableTag, validateTranslatableTagAttribute
-
-
-
-
Method Detail
-
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 java.lang.Boolean validatePreformatTag(java.lang.String tag, Attributes atts)
In the XLIFF filter, the tag <mrk> is a preformat tag when the attribute "mtype" contains "seg".- Specified by:
validatePreformatTag
in interfaceXMLDialect
- Overrides:
validatePreformatTag
in classDefaultXMLDialect
- Parameters:
tag
- An XML tagatts
- The attributes associated with the tag- Returns:
true
if this tag should be a preformat tag,false
otherwise
-
validateIntactTag
public java.lang.Boolean validateIntactTag(java.lang.String tag, Attributes atts)
In the XLKIFF filter, content shouldn't be translated if translate="no" http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#translate- Specified by:
validateIntactTag
in interfaceXMLDialect
- Overrides:
validateIntactTag
in classDefaultXMLDialect
- Parameters:
tag
- An XML tagatts
- The attributes associated with the tag- Returns:
false
if the content of this tag should be translated,true
otherwise
-
validateContentBasedTag
public java.lang.Boolean validateContentBasedTag(java.lang.String tag, 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 interfaceXMLDialect
- Overrides:
validateContentBasedTag
in classDefaultXMLDialect
- Parameters:
tag
- The tag that could be translatedatts
- The list of the tag attributes- Returns:
true
orfalse
-
handleXMLTag
public void handleXMLTag(XMLTag tag, boolean translated)
Handle <target state="..."> attribute according to filter settings.- Specified by:
handleXMLTag
in interfaceXMLDialect
- Overrides:
handleXMLTag
in classDefaultXMLDialect
- Parameters:
tag
- XML tag to be processed.translated
- is the value considered translated?- See Also:
- RFE #1506
-
constructShortcuts
public java.lang.String constructShortcuts(java.util.List<Element> elements, java.util.List<ProtectedPart> protectedParts)
Description copied from class:DefaultXMLDialect
Returns shortcut string representation of the entry source. This is what the user translates. E.g. forHere's <b>bold text</b>
should returnHere's <b0>bold text</b0>
.- Specified by:
constructShortcuts
in interfaceXMLDialect
- Overrides:
constructShortcuts
in classDefaultXMLDialect
-
-