Package org.omegat.filters3
Class Entry
java.lang.Object
org.omegat.filters3.Entry
- Direct Known Subclasses:
XMLIntactEntry
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an element to this entry.voidclear()Cleans up this entry.get(int i) Gets an element.booleanisEmpty()Returns whether or not the elements list is empty.voidremove(int index) Removes an element from this entry.voidvoidsetTranslation(String translation, XMLDialect xmlDialect, List<ProtectedPart> protectedParts) Sets the translation of the shortcut string returned byTag.toShortcut().intsize()Returns the number of source elements.Returns the entry source in its original form as it was in original document.sourceToShortcut(boolean tagsAggregation, XMLDialect xmlDialect, List<ProtectedPart> protectedParts) Returns shortcut string representation of the entry source.Returns long XML-encoded representation of the source entry for storing in TMX.Returns the translated entry as it should be stored in translated document.Returns long XML-encoded representation of the entry translation for storing in TMX.
-
Constructor Details
-
Entry
-
-
Method Details
-
clear
public void clear()Cleans up this entry. -
resetTagDetected
public void resetTagDetected() -
sourceToShortcut
public String sourceToShortcut(boolean tagsAggregation, XMLDialect xmlDialect, 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
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
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(String translation, XMLDialect xmlDialect, List<ProtectedPart> protectedParts) throws TranslationException Sets the translation of the shortcut string returned byTag.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> textshould not be translated asEtot tekst poluzhirnyi. - End tag goes after corresponding beginning tag. For example,
It's <b>bold</b> textshould 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> textshould 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> textcan 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
Returns long XML-encoded representation of the entry translation for storing in TMX. -
translationToOriginal
Returns the translated entry as it should be stored in translated document. -
add
-
remove
public void remove(int index) Removes an element from this entry. -
get
-
size
public int size()Returns the number of source elements. -
isEmpty
public boolean isEmpty()Returns whether or not the elements list is empty.
-