diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/TextUnitUtils.java b/common/src/main/java/com/box/l10n/mojito/okapi/TextUnitUtils.java index a315f816ef..a128c8e560 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/TextUnitUtils.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/TextUnitUtils.java @@ -1,7 +1,7 @@ package com.box.l10n.mojito.okapi; import java.util.Objects; -import net.sf.okapi.common.annotation.XLIFFNoteAnnotation; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.resource.ITextUnit; import net.sf.okapi.common.resource.Property; import net.sf.okapi.common.resource.TextContainer; @@ -30,12 +30,12 @@ public String getNote(ITextUnit textUnit) { if (textUnit != null) { - XLIFFNoteAnnotation xliffNoteAnnotation = textUnit.getAnnotation(XLIFFNoteAnnotation.class); + NoteAnnotation noteAnnotation = textUnit.getAnnotation(NoteAnnotation.class); - if (xliffNoteAnnotation == null) { - note = Objects.toString(textUnit.getProperty(Property.NOTE), null); + if (noteAnnotation == null) { + note = Objects.toString(textUnit.getProperty(NoteAnnotation.LOC_NOTE), null); } else { - note = xliffNoteAnnotation.getNote(0).getNoteText(); + note = noteAnnotation.getNote(0).getNoteText(); } } @@ -51,7 +51,7 @@ public String getNote(ITextUnit textUnit) { public void setNote(ITextUnit textUnit, String note) { if (textUnit != null) { - textUnit.setProperty(new Property(Property.NOTE, note)); + textUnit.setProperty(new Property(NoteAnnotation.LOC_NOTE, note)); } } diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/filters/AndroidFilter.java b/common/src/main/java/com/box/l10n/mojito/okapi/filters/AndroidFilter.java index 690df5243f..329f0ee4d9 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/filters/AndroidFilter.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/filters/AndroidFilter.java @@ -8,9 +8,9 @@ import net.sf.okapi.common.Event; import net.sf.okapi.common.IResource; import net.sf.okapi.common.LocaleId; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.filters.FilterConfiguration; import net.sf.okapi.common.resource.ITextUnit; -import net.sf.okapi.common.resource.Property; import net.sf.okapi.common.resource.RawDocument; import net.sf.okapi.common.resource.TextUnit; import net.sf.okapi.common.skeleton.GenericSkeleton; @@ -198,7 +198,7 @@ protected void extractNoteFromXMLCommentInSkeletonIfNone(TextUnit textUnit) { String skeleton = textUnit.getSkeleton().toString(); - if (textUnit.getProperty(Property.NOTE) == null) { + if (textUnit.getProperty(NoteAnnotation.LOC_NOTE) == null) { String note = getNoteFromXMLCommentsInSkeleton(skeleton); if (note != null) { textUnitUtils.setNote(textUnit, note); diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/filters/CSVFilter.java b/common/src/main/java/com/box/l10n/mojito/okapi/filters/CSVFilter.java index 1e5b30c654..a96c5765a4 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/filters/CSVFilter.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/filters/CSVFilter.java @@ -1,5 +1,6 @@ package com.box.l10n.mojito.okapi.filters; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.resource.ITextUnit; import net.sf.okapi.common.resource.Property; import net.sf.okapi.filters.table.csv.CommaSeparatedValuesFilter; @@ -45,7 +46,7 @@ public CSVFilter() { @Override protected boolean processTU(ITextUnit textUnit) { - Property note = textUnit.getProperty(Property.NOTE); + Property note = textUnit.getProperty(NoteAnnotation.LOC_NOTE); if (note != null) { String comments = note.toString(); char quote = "\"".charAt(0); diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSFilter.java b/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSFilter.java index 0426dad4e2..7b0a6ae3f6 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSFilter.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSFilter.java @@ -14,6 +14,7 @@ import net.sf.okapi.common.IParameters; import net.sf.okapi.common.MimeTypeMapper; import net.sf.okapi.common.Util; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.encoder.EncoderManager; import net.sf.okapi.common.exceptions.OkapiIOException; import net.sf.okapi.common.exceptions.OkapiUnsupportedEncodingException; @@ -268,7 +269,7 @@ private TextUnit readTextUnit() { skel.append(data.toString()); textUnit = processKeyValueLine(); if (textUnit != null && comment != null) { - textUnit.setProperty(new Property(Property.NOTE, comment, true)); + textUnit.setProperty(new Property(NoteAnnotation.LOC_NOTE, comment, true)); } break; } else { diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSONFilter.java b/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSONFilter.java index 255d5ab2f6..0e9e43fe01 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSONFilter.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/filters/JSONFilter.java @@ -10,8 +10,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.okapi.common.Event; -import net.sf.okapi.common.annotation.XLIFFNote; -import net.sf.okapi.common.annotation.XLIFFNoteAnnotation; +import net.sf.okapi.common.annotation.Note; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.filters.FilterConfiguration; import net.sf.okapi.common.resource.ITextUnit; import net.sf.okapi.common.resource.RawDocument; @@ -44,7 +44,7 @@ public class JSONFilter extends net.sf.okapi.filters.json.JSONFilter { */ boolean noteKeepOrReplace = false; - XLIFFNoteAnnotation xliffNoteAnnotation; + NoteAnnotation xliffNoteAnnotation; UsagesAnnotation usagesAnnotation; String currentKeyName; String comment = null; @@ -145,13 +145,13 @@ void extractUsageIfMatch(String value) { } void addXliffNote(String value) { - XLIFFNote xliffNote = new XLIFFNote(value); + Note xliffNote = new Note(value); xliffNote.setFrom(currentKeyName); - xliffNote.setAnnotates(XLIFFNote.Annotates.SOURCE); + xliffNote.setAnnotates(Note.Annotates.SOURCE); if (xliffNoteAnnotation == null || noteKeepOrReplace) { logger.debug("create the xliff note annotation"); - xliffNoteAnnotation = new XLIFFNoteAnnotation(); + xliffNoteAnnotation = new NoteAnnotation(); } xliffNoteAnnotation.add(xliffNote); diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/filters/MacStringsdictFilterKey.java b/common/src/main/java/com/box/l10n/mojito/okapi/filters/MacStringsdictFilterKey.java index afb13631cf..7ca3d8eb48 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/filters/MacStringsdictFilterKey.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/filters/MacStringsdictFilterKey.java @@ -6,6 +6,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.okapi.common.*; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.filters.FilterConfiguration; import net.sf.okapi.common.resource.*; import net.sf.okapi.common.skeleton.GenericSkeleton; @@ -121,7 +122,7 @@ protected void extractNoteFromXMLCommentInSkeletonIfNone(TextUnit textUnit) { String skeleton = textUnit.getSkeleton().toString(); - if (textUnit.getProperty(Property.NOTE) == null) { + if (textUnit.getProperty(NoteAnnotation.LOC_NOTE) == null) { String note = getNoteFromXMLCommentsInSkeleton(skeleton); if (note != null) { comment = note; diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/steps/FilterEventsToInMemoryRawDocumentStep.java b/common/src/main/java/com/box/l10n/mojito/okapi/steps/FilterEventsToInMemoryRawDocumentStep.java index a7119fea45..5c3c93c401 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/steps/FilterEventsToInMemoryRawDocumentStep.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/steps/FilterEventsToInMemoryRawDocumentStep.java @@ -80,7 +80,7 @@ public Event handleEvent(Event event) { switch (event.getEventType()) { case START_DOCUMENT: handleStartDocument(event); - return Event.NOOP_EVENT; + return Event.createNoopEvent(); case END_DOCUMENT: return processEndDocument(event); @@ -95,7 +95,7 @@ public Event handleEvent(Event event) { case TEXT_UNIT: // handle all the events between START_DOCUMENT and END_DOCUMENT filterWriter.handleEvent(event); - return Event.NOOP_EVENT; + return Event.createNoopEvent(); } // Else, just return the event diff --git a/pom.xml b/pom.xml index bcee90bfe1..4b40a50089 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 3.5.1 2.8.2 2.5.3 - 0.36 + 1.45.0 29.0-jre 1.4 6.0.1.GA diff --git a/webapp/src/main/java/com/box/l10n/mojito/okapi/ImportExportTextUnitUtils.java b/webapp/src/main/java/com/box/l10n/mojito/okapi/ImportExportTextUnitUtils.java index 381fe2d68d..cef36422f5 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/okapi/ImportExportTextUnitUtils.java +++ b/webapp/src/main/java/com/box/l10n/mojito/okapi/ImportExportTextUnitUtils.java @@ -3,8 +3,8 @@ import com.box.l10n.mojito.json.ObjectMapper; import com.box.l10n.mojito.service.tm.ImportExportNote; import java.io.IOException; -import net.sf.okapi.common.annotation.XLIFFNote; -import net.sf.okapi.common.annotation.XLIFFNoteAnnotation; +import net.sf.okapi.common.annotation.Note; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.resource.ITextUnit; import net.sf.okapi.common.resource.Property; import net.sf.okapi.common.resource.TextUnit; @@ -33,7 +33,7 @@ public class ImportExportTextUnitUtils { public void setNote(ITextUnit textUnit, String note) { if (textUnit != null) { - textUnit.setProperty(new Property(Property.NOTE, note)); + textUnit.setProperty(new Property(NoteAnnotation.LOC_NOTE, note)); } } @@ -76,15 +76,15 @@ public void setImportExportNote(ITextUnit textUnit, ImportExportNote importExpor String importExportNoteStr = objectMapper.writeValueAsStringUnchecked(importExportNote); - XLIFFNoteAnnotation xliffNoteAnnotation = textUnit.getAnnotation(XLIFFNoteAnnotation.class); + NoteAnnotation noteAnnotation = textUnit.getAnnotation(NoteAnnotation.class); - if (xliffNoteAnnotation == null) { - xliffNoteAnnotation = new XLIFFNoteAnnotation(); - textUnit.setAnnotation(xliffNoteAnnotation); + if (noteAnnotation == null) { + noteAnnotation = new NoteAnnotation(); + textUnit.setAnnotation(noteAnnotation); } else { setNote(textUnit, importExportNoteStr); } - xliffNoteAnnotation.add(new XLIFFNote(importExportNoteStr)); + noteAnnotation.add(new Note(importExportNoteStr)); } } diff --git a/webapp/src/main/java/com/box/l10n/mojito/okapi/TranslateStep.java b/webapp/src/main/java/com/box/l10n/mojito/okapi/TranslateStep.java index b77c3ab405..e4ebcdb9ec 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/okapi/TranslateStep.java +++ b/webapp/src/main/java/com/box/l10n/mojito/okapi/TranslateStep.java @@ -138,7 +138,7 @@ protected Event handleTextUnit(Event event) { if (androidEvent == null) { switch (getRemoveUntranslatedStrategyFromAnnotation()) { case NOOP_EVENT: - event = Event.NOOP_EVENT; + event = Event.createNoopEvent(); break; case PLACEHOLDER_AND_POST_PROCESSING: logger.debug("Set untranslated placeholder for text unit with name: {}", name); diff --git a/webapp/src/main/java/com/box/l10n/mojito/okapi/XLIFFWriter.java b/webapp/src/main/java/com/box/l10n/mojito/okapi/XLIFFWriter.java index c5ff71ef39..1aebe969fd 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/okapi/XLIFFWriter.java +++ b/webapp/src/main/java/com/box/l10n/mojito/okapi/XLIFFWriter.java @@ -18,9 +18,9 @@ import net.sf.okapi.common.annotation.GenericAnnotations; import net.sf.okapi.common.annotation.ITSLQIAnnotations; import net.sf.okapi.common.annotation.ITSProvenanceAnnotations; +import net.sf.okapi.common.annotation.Note; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.annotation.TermsAnnotation; -import net.sf.okapi.common.annotation.XLIFFNote; -import net.sf.okapi.common.annotation.XLIFFNoteAnnotation; import net.sf.okapi.common.encoder.EncoderManager; import net.sf.okapi.common.filterwriter.IFilterWriter; import net.sf.okapi.common.filterwriter.ITSContent; @@ -602,24 +602,24 @@ public void writeTextUnit(ITextUnit tu, String phaseName) { } // Notes - if (tu.hasProperty(Property.NOTE)) { - writer.writeStartElement("note"); - writer.writeString(tu.getProperty(Property.NOTE).getValue()); + if (tu.hasProperty(NoteAnnotation.LOC_NOTE)) { + writer.writeStartElement(NoteAnnotation.LOC_NOTE); + writer.writeString(tu.getProperty(NoteAnnotation.LOC_NOTE).getValue()); writer.writeEndElementLineBreak(); // note } - if (tu.hasProperty(Property.TRANSNOTE)) { - writer.writeStartElement("note"); + if (tu.hasProperty(NoteAnnotation.TRANS_NOTE)) { + writer.writeStartElement(NoteAnnotation.LOC_NOTE); writer.writeAttributeString("from", "translator"); - writer.writeString(tu.getProperty(Property.TRANSNOTE).getValue()); + writer.writeString(tu.getProperty(NoteAnnotation.TRANS_NOTE).getValue()); writer.writeEndElementLineBreak(); // note } // CHANGES FOR MOJITO - XLIFFNoteAnnotation annotation = tu.getAnnotation(XLIFFNoteAnnotation.class); + NoteAnnotation annotation = tu.getAnnotation(NoteAnnotation.class); if (annotation != null) { - XLIFFNote note = annotation.getNote(0); - writer.writeStartElement("note"); + Note note = annotation.getNote(0); + writer.writeStartElement(NoteAnnotation.LOC_NOTE); writer.writeString(note.getNoteText()); writer.writeEndElementLineBreak(); } diff --git a/webapp/src/main/java/com/box/l10n/mojito/okapi/qualitycheck/Parameters.java b/webapp/src/main/java/com/box/l10n/mojito/okapi/qualitycheck/Parameters.java index 218c5d24ff..ff410462bc 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/okapi/qualitycheck/Parameters.java +++ b/webapp/src/main/java/com/box/l10n/mojito/okapi/qualitycheck/Parameters.java @@ -19,7 +19,6 @@ public void disableAllChecks() { setCheckXliffSchema(false); setCheckPatterns(false); setCheckWithLT(false); - setTranslateLTMsg(false); setLtBilingualMode(false); setDoubledWord(false); setCorruptedCharacters(false); diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/translationkit/TranslationKitFilter.java b/webapp/src/main/java/com/box/l10n/mojito/service/translationkit/TranslationKitFilter.java index 6b590dbb10..916c4d5506 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/translationkit/TranslationKitFilter.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/translationkit/TranslationKitFilter.java @@ -19,8 +19,8 @@ import net.sf.okapi.common.EventType; import net.sf.okapi.common.IParameters; import net.sf.okapi.common.LocaleId; -import net.sf.okapi.common.annotation.XLIFFNote; -import net.sf.okapi.common.annotation.XLIFFNoteAnnotation; +import net.sf.okapi.common.annotation.Note; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.encoder.EncoderManager; import net.sf.okapi.common.filters.FilterConfiguration; import net.sf.okapi.common.filters.IFilter; @@ -235,10 +235,10 @@ private TextUnit getNextTextUnit() throws NoSuchElementException { if (textUnitDTO.getComment() != null) { importExportTextUnitUtils.setNote(textUnit, textUnitDTO.getComment()); - XLIFFNoteAnnotation xliffNoteAnnotation = new XLIFFNoteAnnotation(); - XLIFFNote xliffNote = new XLIFFNote(textUnitDTO.getComment()); - xliffNoteAnnotation.add(xliffNote); - textUnit.getSource().setAnnotation(xliffNoteAnnotation); + NoteAnnotation noteAnnotation = new NoteAnnotation(); + Note xliffNote = new Note(textUnitDTO.getComment()); + noteAnnotation.add(xliffNote); + textUnit.getSource().setAnnotation(noteAnnotation); } return textUnit; diff --git a/webapp/src/test/java/com/box/l10n/mojito/factory/XliffDataFactory.java b/webapp/src/test/java/com/box/l10n/mojito/factory/XliffDataFactory.java index d8ee736fd8..2ef852b934 100644 --- a/webapp/src/test/java/com/box/l10n/mojito/factory/XliffDataFactory.java +++ b/webapp/src/test/java/com/box/l10n/mojito/factory/XliffDataFactory.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Objects; import net.sf.okapi.common.LocaleId; +import net.sf.okapi.common.annotation.NoteAnnotation; import net.sf.okapi.common.resource.Property; import net.sf.okapi.common.resource.TextContainer; import net.sf.okapi.common.resource.TextUnit; @@ -51,7 +52,7 @@ public TextUnit createTextUnit( textUnit.setName(name); if (note != null) { - textUnit.setSourceProperty(new Property(Property.NOTE, note)); + textUnit.setSourceProperty(new Property(NoteAnnotation.LOC_NOTE, note)); } if (target != null && targetBcp47Tag != null) { @@ -130,7 +131,7 @@ private String generateXliff(List textUnits, String targetBcp47Tag) { ">" + textUnit.getTarget(LocaleId.fromBCP47(targetBcp47Tag)).toString() + "\n"; } - String note = Objects.toString(textUnit.getSourceProperty(Property.NOTE), null); + String note = Objects.toString(textUnit.getSourceProperty(NoteAnnotation.LOC_NOTE), null); if (note != null) { if (!isTargetXliff) { // Okapi does not indent code properly...