-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Okapi Dependency Update from V. 0.36 to 1.43.0 #12
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,4 +64,4 @@ components: | |
schema: | ||
type: string | ||
pattern: ^\d+$ | ||
maxLength: 18 | ||
maxLength: 18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,4 +64,4 @@ components: | |
schema: | ||
type: string | ||
pattern: ^\d+$ | ||
maxLength: 18 | ||
maxLength: 18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,4 +64,4 @@ components: | |
schema: | ||
type: string | ||
pattern: ^\d+$ | ||
maxLength: 18 | ||
maxLength: 18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that a new class in addition to XLIFFNoteAnnotation or is replacing it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its a replacement, XLIFFNoteAnnotation was deprecated and got removed already. |
||
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 noteAnnotation; | ||
UsagesAnnotation usagesAnnotation; | ||
String currentKeyName; | ||
String comment = null; | ||
|
@@ -144,17 +144,17 @@ void extractUsageIfMatch(String value) { | |
} | ||
} | ||
|
||
void addXliffNote(String value) { | ||
XLIFFNote xliffNote = new XLIFFNote(value); | ||
xliffNote.setFrom(currentKeyName); | ||
xliffNote.setAnnotates(XLIFFNote.Annotates.SOURCE); | ||
void addNote(String value) { | ||
Note note = new Note(value); | ||
note.setFrom(currentKeyName); | ||
note.setAnnotates(Note.Annotates.SOURCE); | ||
|
||
if (xliffNoteAnnotation == null || noteKeepOrReplace) { | ||
logger.debug("create the xliff note annotation"); | ||
xliffNoteAnnotation = new XLIFFNoteAnnotation(); | ||
if (noteAnnotation == null || noteKeepOrReplace) { | ||
logger.debug("create the note annotation"); | ||
noteAnnotation = new NoteAnnotation(); | ||
} | ||
|
||
xliffNoteAnnotation.add(xliffNote); | ||
noteAnnotation.add(note); | ||
} | ||
|
||
void extractNoteIfMatch(String value) { | ||
|
@@ -163,7 +163,7 @@ void extractNoteIfMatch(String value) { | |
|
||
if (m.matches()) { | ||
logger.debug("key matches noteKeyPattern, add the value as note"); | ||
addXliffNote(value); | ||
addNote(value); | ||
} | ||
} | ||
} | ||
|
@@ -172,10 +172,10 @@ void processComment() { | |
if (comment != null) { | ||
ITextUnit textUnit = getEventTextUnit(); | ||
if (textUnit != null) { | ||
String xliffNote = comment.replace("//", "").trim(); | ||
addXliffNote(xliffNote); | ||
textUnit.setAnnotation(xliffNoteAnnotation); | ||
xliffNoteAnnotation = null; | ||
String note = comment.replace("//", "").trim(); | ||
addNote(note); | ||
textUnit.setAnnotation(noteAnnotation); | ||
noteAnnotation = null; | ||
} | ||
comment = null; | ||
} | ||
|
@@ -184,14 +184,14 @@ void processComment() { | |
@Override | ||
public void handleObjectEnd() { | ||
|
||
if (xliffNoteAnnotation != null || usagesAnnotation != null) { | ||
if (noteAnnotation != null || usagesAnnotation != null) { | ||
|
||
ITextUnit textUnit = getEventTextUnit(); | ||
|
||
if (textUnit != null) { | ||
if (xliffNoteAnnotation != null) { | ||
if (noteAnnotation != null) { | ||
logger.debug("Set note on text unit with name: {}", textUnit.getName()); | ||
textUnit.setAnnotation(xliffNoteAnnotation); | ||
textUnit.setAnnotation(noteAnnotation); | ||
} | ||
|
||
if (usagesAnnotation != null) { | ||
|
@@ -203,10 +203,9 @@ public void handleObjectEnd() { | |
} | ||
} | ||
|
||
logger.debug( | ||
"Reset the xliffNoteAnnotation and Usage Annotation if not using keepOrReplace option"); | ||
logger.debug("Reset the noteAnnotation and Usage Annotation if not using keepOrReplace option"); | ||
if (!noteKeepOrReplace) { | ||
xliffNoteAnnotation = null; | ||
noteAnnotation = null; | ||
} | ||
|
||
if (!usagesKeepOrReplace) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was that class removed?