Package org.omegat.filters3
Class Entry
- java.lang.Object
-
- org.omegat.filters3.Entry
-
- Direct Known Subclasses:
XMLIntactEntry
public class Entry extends java.lang.Object
Translatable entry. Holds a list of source tags and text, translated text and maintains correspondence between tags in source and in target.
-
-
Constructor Summary
Constructors Constructor Description Entry(XMLDialect xmlDialect, Handler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Element elem)
Adds an element to this entry.void
clear()
Cleans up this entry.Element
get(int i)
Gets an element.boolean
isEmpty()
Returns whether or not the elements list is empty.void
remove(int index)
Removes an element from this entry.void
resetTagDetected()
void
setTranslation(java.lang.String translation, XMLDialect xmlDialect, java.util.List<ProtectedPart> protectedParts)
Sets the translation of the shortcut string returned by#toShortcut()
.int
size()
Returns the number of source elements.java.lang.String
sourceToOriginal()
Returns the entry source in its original form as it was in original document.java.lang.String
sourceToShortcut(boolean tagsAggregation, XMLDialect xmlDialect, java.util.List<ProtectedPart> protectedParts)
Returns shortcut string representation of the entry source.java.lang.String
sourceToTMX()
Returns long XML-encoded representation of the source entry for storing in TMX.java.lang.String
translationToOriginal()
Returns the translated entry as it should be stored in translated document.java.lang.String
translationToTMX()
Returns long XML-encoded representation of the entry translation for storing in TMX.
-
-
-
Constructor Detail
-
Entry
public Entry(XMLDialect xmlDialect, Handler handler)
-
-
Method Detail
-
clear
public void clear()
Cleans up this entry.
-
resetTagDetected
public void resetTagDetected()
-
sourceToShortcut
public java.lang.String sourceToShortcut(boolean tagsAggregation, XMLDialect xmlDialect, java.util.List<ProtectedPart> protectedParts)
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>
.- Parameters:
tagsAggregation
- Whether tags of this entry can be aggregated.xmlDialect
- dialect for processing shortcuts
-
sourceToTMX
public java.lang.String sourceToTMX()
Returns long XML-encoded representation of the source entry for storing in TMX. E.g. forHere's <b>bold text</b>
should returnHere's <bpt i="0">&b0></bpt>bold text<ept i="0"></b0></ept>
.
-
sourceToOriginal
public java.lang.String sourceToOriginal()
Returns the entry source in its original form as it was in original document. E.g. forHere's <b>bold text</b>
should return the same stringHere's <b>bold text</b>
.
-
setTranslation
public void setTranslation(java.lang.String translation, XMLDialect xmlDialect, java.util.List<ProtectedPart> protectedParts) throws TranslationException
Sets the translation of the shortcut string returned by#toShortcut()
. Before setting translation checks whether the translation contains all the same tags in weakly correct order:- All the tags present in source must be present in translation. For
example,
It's <b>bold</b> text
should not be translated asEtot tekst poluzhirnyi
. - End tag goes after corresponding beginning tag. For example,
It's <b>bold</b> text
should not be translated asEtot tekst </b>poluzhirnyi<b>
. - If standalone tag or tag pair was enclosed in another tag pair in
source, it should be enclosed in translation. For example,
It's <b>bold and <i>bold italic</i></b> text
should not be translated asEtot tekst <b>poluzhirnyi</b> i <i>naklonnyi</i>
. - Independent standalone tags and tag pairs may be reordered within
entry. For example,
It's <b>bold</b> and <i>italic</i> text
can be translated asEtot tekst <i>naklonnyi</i> i <b>poluzhirnyi</b>
.
- Throws:
TranslationException
- -- if any tag is missing or tags are ordered incorrectly.
- All the tags present in source must be present in translation. For
example,
-
translationToTMX
public java.lang.String translationToTMX()
Returns long XML-encoded representation of the entry translation for storing in TMX.
-
translationToOriginal
public java.lang.String translationToOriginal()
Returns the translated entry as it should be stored in translated document.
-
add
public void add(Element elem)
-
remove
public void remove(int index)
Removes an element from this entry.
-
get
public Element get(int i)
-
size
public int size()
Returns the number of source elements.
-
isEmpty
public boolean isEmpty()
Returns whether or not the elements list is empty.
-
-