-
Notifications
You must be signed in to change notification settings - Fork 70
feat: add file translations APIs #363
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/crowdin/client/ai/model/AiFileTranslation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package com.crowdin.client.ai.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.util.Date; | ||
|
|
||
| @Data | ||
| public class AiFileTranslation { | ||
| private String identifier; | ||
| private String status; | ||
| private Long progress; | ||
| private Attributes attributes; | ||
| private Date createdAt; | ||
| private Date updatedAt; | ||
| private Date startedAt; | ||
| private Date finishedAt; | ||
|
|
||
| @Data | ||
| public static class Attributes { | ||
| private String stage; | ||
| private FileTranslationError error; | ||
| private String downloadName; | ||
| private String sourceLanguageId; | ||
| private String targetLanguageId; | ||
| private String originalFileName; | ||
| private String detectedType; | ||
| private Integer parserVersion; | ||
| } | ||
|
|
||
| @Data | ||
| private static class FileTranslationError { | ||
| private String stage; | ||
| private String message; | ||
| } | ||
|
zshs000 marked this conversation as resolved.
|
||
| } | ||
21 changes: 21 additions & 0 deletions
21
src/main/java/com/crowdin/client/ai/model/AiFileTranslationAddRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.crowdin.client.ai.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Data | ||
| public class AiFileTranslationAddRequest { | ||
| private Long storageId; | ||
| private String sourceLanguageId; | ||
| private String targetLanguageId; | ||
| private String type; | ||
| private Integer parserVersion; | ||
| private List<Long> tmIds; | ||
| private List<Long> glossaryIds; | ||
| private Long aiPromptId; | ||
| private Long aiProviderId; | ||
| private String aiModelId; | ||
| private List<String> instructions; | ||
| private List<Long> attachmentIds; | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/crowdin/client/ai/model/AiFileTranslationResponseObject.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.crowdin.client.ai.model; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class AiFileTranslationResponseObject { | ||
| private AiFileTranslation data; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/resources/api/ai/addAiFileTranslationRequest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "storageId": 123, | ||
| "sourceLanguageId": "en", | ||
| "targetLanguageId": "uk", | ||
| "type": "xliff", | ||
| "parserVersion": 1, | ||
| "tmIds": [ | ||
| 123 | ||
| ], | ||
| "glossaryIds": [ | ||
| 456 | ||
| ], | ||
| "aiPromptId": 789, | ||
| "aiProviderId": 12, | ||
| "aiModelId": "gpt-4.1", | ||
| "instructions": [ | ||
| "Keep a formal tone" | ||
| ], | ||
| "attachmentIds": [ | ||
| 123 | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "data": { | ||
| "identifier": "50fb3506-4127-4ba8-8296-f97dc7e3e0c3", | ||
| "status": "finished", | ||
| "progress": 100, | ||
| "attributes": { | ||
| "stage": "translate", | ||
| "error": { | ||
| "stage": "import", | ||
| "message": "Failed to parse file" | ||
| }, | ||
| "downloadName": "file.pdf", | ||
| "sourceLanguageId": "en", | ||
| "targetLanguageId": "uk", | ||
| "originalFileName": "Sample_Chrome.json", | ||
| "detectedType": "chrome", | ||
| "parserVersion": 2 | ||
| }, | ||
| "createdAt": "2026-01-23T11:26:54+00:00", | ||
| "updatedAt": "2026-01-23T11:26:54+00:00", | ||
| "startedAt": "2026-01-23T11:26:54+00:00", | ||
| "finishedAt": "2026-01-23T11:26:54+00:00" | ||
| } | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/test/resources/api/ai/downloadAiFileTranslationResponse.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "data": { | ||
| "url": "https://production-enterprise-importer.downloads.crowdin.com/992000002/2/14.xliff?response-content-disposition={disposition}&X-Amz-Content-Sha256={sha}&X-Amz-Algorithm={algorithm}&X-Amz-Credential={credentials}&X-Amz-Date={date}&X-Amz-SignedHeaders={headers}&X-Amz-Expires={expires}&X-Amz-Signature={signature}", | ||
| "expireIn": "2019-09-20T10:31:21+00:00" | ||
| } | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/test/resources/api/ai/downloadAiFileTranslationStringsResponse.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "data": { | ||
| "url": "https://production-enterprise-importer.downloads.crowdin.com/992000002/2/14.xliff?response-content-disposition={disposition}&X-Amz-Content-Sha256={sha}&X-Amz-Algorithm={algorithm}&X-Amz-Credential={credentials}&X-Amz-Date={date}&X-Amz-SignedHeaders={headers}&X-Amz-Expires={expires}&X-Amz-Signature={signature}", | ||
| "expireIn": "2019-09-20T10:31:21+00:00" | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.