Package net.sf.okapi.common.resource

Examples of net.sf.okapi.common.resource.TextUnit


                if (event.getEventType() == EventType.START_SUBDOCUMENT) {
                    StartSubDocument startSubDoc =
                            (StartSubDocument) event.getResource();
                    subDocName = stripPath(startSubDoc.getName());
                } else if (event.getEventType() == EventType.TEXT_UNIT) {
                    TextUnit tu = (TextUnit) event.getResource();
                    if (!tu.getSource().isEmpty() && tu.isTranslatable()) {
                        String content = getTranslatableText(tu);
                        if (!content.isEmpty()) {
                            TextFlow tf =
                                    new TextFlow(getIdFor(tu, content,
                                            subDocName), sourceLocale);
View Full Code Here


                if (event.getEventType() == EventType.START_SUBDOCUMENT) {
                    StartSubDocument startSubDoc =
                            (StartSubDocument) event.getResource();
                    subDocName = stripPath(startSubDoc.getName());
                } else if (event.getEventType() == EventType.TEXT_UNIT) {
                    TextUnit tu = (TextUnit) event.getResource();
                    if (!tu.getSource().isEmpty() && tu.isTranslatable()) {
                        String content = getTranslatableText(tu);
                        if (!content.isEmpty()) {
                            TextFlowTarget tft =
                                    new TextFlowTarget(getIdFor(tu, content, subDocName));
                            tft.setContents(content);
View Full Code Here

                if (event.getEventType() == EventType.START_SUBDOCUMENT) {
                    StartSubDocument startSubDoc =
                            (StartSubDocument) event.getResource();
                    subDocName = stripPath(startSubDoc.getName());
                } else if (event.getEventType() == EventType.TEXT_UNIT) {
                    TextUnit tu = (TextUnit) event.getResource();
                    if (!tu.getSource().isEmpty() && tu.isTranslatable()) {
                        String translatable = getTranslatableText(tu);

                        if (!translatable.isEmpty()) {
                            TextFlowTarget tft =
                                    translations.get(getIdFor(tu,
                                            translatable, subDocName));

                            if (tft != null) {
                                String translated = tft.getContents().get(0);

                                translated =
                                        getFullTranslationText(tu, translated);
                                tu.setTargetContent(localeId, GenericContent
                                        .fromLetterCodedToFragment(
                                                translated, tu.getSource()
                                                .getFirstContent()
                                                .clone(), true, true));
                            }
                        }
                    }
View Full Code Here

TOP

Related Classes of net.sf.okapi.common.resource.TextUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.