Search in sources :

Example 1 with XMLText

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;
}
Also used : XMLText(org.omegat.filters3.xml.XMLText)

Example 2 with XMLText

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));
        }
    }
}
Also used : Element(org.omegat.filters3.Element)

Aggregations

Element (org.omegat.filters3.Element)1 XMLText (org.omegat.filters3.xml.XMLText)1