use of org.omegat.filters3.xml.XMLText in project omegat by omegat-org.
the class XLIFFDialect method calcTagShortcutLetter.
private int calcTagShortcutLetter(XMLContentBasedTag tag, boolean ignoreTypeForPhtags) {
int s;
if (!tag.getIntactContents().isEmpty() && (tag.getIntactContents().get(0) instanceof XMLText)) {
XMLText xmlText = (XMLText) tag.getIntactContents().get(0);
s = StringUtil.getFirstLetterLowercase(xmlText.getText());
} else {
String type = StringUtil.nvl(tag.getAttribute("ctype"), tag.getAttribute("type"));
if (type != null && !ignoreTypeForPhtags) {
s = StringUtil.getFirstLetterLowercase(type);
} else {
s = 0;
}
}
return s;
}
use of org.omegat.filters3.xml.XMLText in project omegat by omegat-org.
the class Handler method queueText.
private void queueText(String s) {
if (!translator.isInIgnored()) {
translator.text(s);
}
// knowing here whether we're inside a preformatted tag, etc.
if (internalEntityStarted != null && s.equals(internalEntityStarted.getValue())) {
currEntry().add(new XMLEntityText(internalEntityStarted));
} else {
boolean added = false;
if (!currEntry().isEmpty()) {
Element elem = currEntry().get(currEntry().size() - 1);
if (elem instanceof XMLText) {
XMLText text = (XMLText) elem;
if (text.isInCDATA() == inCDATA) {
currEntry().resetTagDetected();
text.append(s);
added = true;
}
}
}
if (!added) {
currEntry().add(new XMLText(s, inCDATA));
}
}
}