Skip to content
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

feat(api): Pre-Translations: add Label IDs support #198

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ public class ApplyPreTranslationRequest {
private Boolean translateUntranslatedOnly;
private Boolean translateWithPerfectMatchOnly;
private Boolean markAddedTranslationsAsDone;

private List<Long> labelIds;
private List<Long> excludeLabelIds;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ public static class Attributes {
private boolean duplicateTranslations;
private boolean translateUntranslatedOnly;
private boolean translateWithPerfectMatchOnly;
private List<Long> labelIds;
private List<Long> excludeLabelIds;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,22 @@ public void applyPreTranslationTest() {
request.setFileIds(singletonList(fileId));
request.setAutoApproveOption(AutoApproveOption.NONE);
request.setMethod(Method.MT);
request.setLabelIds(singletonList(10000L));
request.setExcludeLabelIds(singletonList(20000L));
ResponseObject<PreTranslationStatus> preTranslationStatusResponseObject = this.getTranslationsApi().applyPreTranslation(projectId, request);
assertEquals(preTranslationStatusResponseObject.getData().getIdentifier(), preTranslationId);

assertEquals(10000L, preTranslationStatusResponseObject.getData().getAttributes().getLabelIds().get(0));
assertEquals(20000L, preTranslationStatusResponseObject.getData().getAttributes().getExcludeLabelIds().get(0));
}

@Test
public void preTranslationStatusTest() {
ResponseObject<PreTranslationStatus> preTranslationStatusResponseObject = this.getTranslationsApi().preTranslationStatus(projectId, preTranslationId);
assertEquals(preTranslationStatusResponseObject.getData().getIdentifier(), preTranslationId);

assertEquals(10000L, preTranslationStatusResponseObject.getData().getAttributes().getLabelIds().get(0));
assertEquals(20000L, preTranslationStatusResponseObject.getData().getAttributes().getExcludeLabelIds().get(0));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@
2
],
"method": "mt",
"autoApproveOption": "none"
"autoApproveOption": "none",
"labelIds": [
10000
],
"excludeLabelIds": [
20000
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
"autoApproveOption": "all",
"duplicateTranslations": true,
"translateUntranslatedOnly": true,
"translateWithPerfectMatchOnly": true
"translateWithPerfectMatchOnly": true,
"labelIds": [
10000
],
"excludeLabelIds": [
20000
]
},
"createdAt": "2019-09-20T14:05:50+00:00",
"updatedAt": "2019-09-20T14:05:50+00:00",
Expand Down