public class Entry
extends java.lang.Object
Constructor and Description |
---|
Entry(XMLDialect xmlDialect,
Handler handler) |
Modifier and Type | Method and 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.
|
public Entry(XMLDialect xmlDialect, Handler handler)
public void clear()
public void resetTagDetected()
public java.lang.String sourceToShortcut(boolean tagsAggregation, XMLDialect xmlDialect, java.util.List<ProtectedPart> protectedParts)
Here's <b>bold text</b>
should return
Here's <b0>bold text</b0>
.tagsAggregation
- Whether tags of this entry can be aggregated.xmlDialect
- dialect for processing shortcutspublic java.lang.String sourceToTMX()
Here's <b>bold text</b>
should
return Here's <bpt i="0">&b0></bpt>bold
text<ept i="0"></b0></ept>
.public java.lang.String sourceToOriginal()
Here's <b>bold text</b>
should return the same string
Here's <b>bold text</b>
.public void setTranslation(java.lang.String translation, XMLDialect xmlDialect, java.util.List<ProtectedPart> protectedParts) throws TranslationException
#toShortcut()
. Before setting translation checks whether the
translation contains all the same tags in weakly correct order:
It's <b>bold</b> text
should not
be translated as Etot tekst poluzhirnyi
.
It's <b>bold</b> text
should not be
translated as Etot tekst </b>poluzhirnyi<b>
.
It's <b>bold and <i>bold italic</i></b> text
should not be translated as
Etot tekst <b>poluzhirnyi</b> i <i>naklonnyi</i>
.
It's <b>bold</b> and <i>italic</i> text
can be translated as
Etot tekst <i>naklonnyi</i> i <b>poluzhirnyi</b>
.
TranslationException
- -- if any tag is missing or tags are ordered incorrectly.public java.lang.String translationToTMX()
public java.lang.String translationToOriginal()
public void add(Element elem)
public void remove(int index)
public Element get(int i)
public int size()
public boolean isEmpty()