public abstract class Text extends java.lang.Object implements Element
P.S. The most important method is createInstance(String)
.
Constructor and Description |
---|
Text(java.lang.String text)
Creates a new instance of Text initialized with some text.
|
Modifier and Type | Method and 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 calculation
|
java.lang.String |
toShortcut()
Returns shortcut string representation of the element.
|
java.lang.String |
toTMX()
Returns long XML-encoded representation of the element.
|
public Text(java.lang.String text)
public java.lang.String getText()
public boolean isMeaningful()
public void append(java.lang.String text)
public abstract Text createInstance(java.lang.String 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 as
V <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
appropriate toOriginal()
methods for storing translated text, so
it would pick any of the original Text instances, e.g. Text[Friday], and
call createInstance("V ")
,
createInstance("pyatnitzu")
, and
createInstance(" ya vlyublyon.")
.
public java.lang.String toShortcut()
toShortcut
in interface Element
public java.lang.String toSafeCalcShortcut()
Element
toSafeCalcShortcut
in interface Element
public java.lang.String toTMX()
Rock&Roll
should return Rock&Roll
.public abstract java.lang.String toOriginal()
Rock&Roll
should return Rock&Roll
for XML and Rock&Roll
for text files.toOriginal
in interface Element