Package org.omegat.filters3
Class Text
java.lang.Object
org.omegat.filters3.Text
- All Implemented Interfaces:
Element
- Direct Known Subclasses:
XMLEntityText,XMLText
Abstract piece of text.
P.S. The most important method is createInstance(String).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabstract TextcreateInstance(String newText) Creates a new instance of the same class as this one.getText()Returns the piece of text stored.booleanWhether the text is meaningful, i.e.abstract StringReturns the text in its original form as it was in original document.Returns shorcuts like '\b_i0_\b' for statistics calculationReturns shortcut string representation of the element.toTMX()Returns long XML-encoded representation of the element.
-
Constructor Details
-
Text
Creates a new instance of Text initialized with some text.
-
-
Method Details
-
getText
Returns the piece of text stored. -
isMeaningful
public boolean isMeaningful()Whether the text is meaningful, i.e. contains anything but space. -
append
-
createInstance
Creates a new instance of the same class as this one. This method is used while translating to create pieces of translated text.For example, the following HTML sentence
<i>Friday</i> I'm in love.(Tag[<i>], Text[Friday], Tag[</i>], Text[ I'm in love.]) can be translated asV <i>pyatnitzu</i> ya vlyublyon.(Text[V ], Tag[<i>], Text[pyatnitzu], Tag[</i>], Text[ ya vlyublyon.]). Tags are the same, but text is translated. Even the number of text elements might change! So OmegaT must be able to create Text classes with appropriatetoOriginal()methods for storing translated text, so it would pick any of the original Text instances, e.g. Text[Friday], and callcreateInstance("V "),createInstance("pyatnitzu"), andcreateInstance(" ya vlyublyon."). -
toShortcut
Returns shortcut string representation of the element. Basically, the text itself.- Specified by:
toShortcutin interfaceElement
-
toSafeCalcShortcut
Description copied from interface:ElementReturns shorcuts like '\b_i0_\b' for statistics calculation- Specified by:
toSafeCalcShortcutin interfaceElement
-
toTMX
Returns long XML-encoded representation of the element. Basically, the XML-encoded text (< -> < etc). E.g. forRock&Rollshould returnRock&Roll. -
toOriginal
Returns the text in its original form as it was in original document. E.g. forRock&Rollshould returnRock&Rollfor XML andRock&Rollfor text files.- Specified by:
toOriginalin interfaceElement
-