Package org.omegat.filters3
Class Text
- java.lang.Object
-
- org.omegat.filters3.Text
-
- All Implemented Interfaces:
Element
- Direct Known Subclasses:
XMLEntityText
,XMLText
public abstract class Text extends java.lang.Object implements Element
Abstract piece of text.P.S. The most important method is
createInstance(String)
.
-
-
Constructor Summary
Constructors Constructor Description Text(java.lang.String text)
Creates a new instance of Text initialized with some text.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
append(java.lang.String text)
abstract Text
createInstance(java.lang.String text)
Creates a new instance of the same class as this one.java.lang.String
getText()
Returns the piece of text stored.boolean
isMeaningful()
Whether the text is meaningful, i.e.abstract java.lang.String
toOriginal()
Returns the text in its original form as it was in original document.java.lang.String
toSafeCalcShortcut()
Returns shorcuts like '\b_i0_\b' for statistics calculationjava.lang.String
toShortcut()
Returns shortcut string representation of the element.java.lang.String
toTMX()
Returns long XML-encoded representation of the element.
-
-
-
Method Detail
-
getText
public java.lang.String getText()
Returns the piece of text stored.
-
isMeaningful
public boolean isMeaningful()
Whether the text is meaningful, i.e. contains anything but space.
-
append
public void append(java.lang.String text)
-
createInstance
public abstract Text createInstance(java.lang.String text)
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
public java.lang.String toShortcut()
Returns shortcut string representation of the element. Basically, the text itself.- Specified by:
toShortcut
in interfaceElement
-
toSafeCalcShortcut
public java.lang.String toSafeCalcShortcut()
Description copied from interface:Element
Returns shorcuts like '\b_i0_\b' for statistics calculation- Specified by:
toSafeCalcShortcut
in interfaceElement
-
toTMX
public java.lang.String toTMX()
Returns long XML-encoded representation of the element. Basically, the XML-encoded text (< -> < etc). E.g. forRock&Roll
should returnRock&Roll
.
-
toOriginal
public abstract java.lang.String toOriginal()
Returns the text in its original form as it was in original document. E.g. forRock&Roll
should returnRock&Roll
for XML andRock&Roll
for text files.- Specified by:
toOriginal
in interfaceElement
-
-