Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

fixes performance issues and output file#12

Open
tylerthehaas wants to merge 31 commits intolyqht:mainfrom
tylerthehaas:main
Open

fixes performance issues and output file#12
tylerthehaas wants to merge 31 commits intolyqht:mainfrom
tylerthehaas:main

Conversation

@tylerthehaas
Copy link
Copy Markdown

When using this I noticed that large json files with a lot of strings being translated to multiple languages (14 in our case) was taking a very long time (over an hour). This was due to sending one string per request and waiting for each response before sending the next string to be translated.

This PR changes that to the following approach:

  1. collect all the strings and their associated keys into their own arrays
  2. batch as many strings as possible into one request. Deepl allows for the total request size to be 128KiB. I am assuming that our request overhead is 2KiB in order to measure and calculate how many strings we can send in a single batch.
  3. Send all requests in parallel to optimize for speed. An exponential backoff retry is added to account for rate limiting.
  4. when we receive the responses back for each language reassemble the translated text back to their associated key to produce the translated json file.

Copy link
Copy Markdown
Owner

@lyqht lyqht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good, left some comments

Comment thread action.yml
Comment on lines +1 to +2
name: 'DeepL API Translate Github Action'
author: 'Tyler Haas'
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm o_O

Comment thread playground/nested.json
},
"profile": {
"intro": "What is up for snacks later?"
"admin": {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this your project's json file? 😂

I would prefer it if this playground nested.json simpler and not as extensive. Let's keep it to max of 60 lines so that it's easier for users to understand it.

tylerthehaas and others added 19 commits September 15, 2025 10:17
…ptions parameter of the translateText call to DeepL-Node
…ts, and adjust documentation in action.yml accordingly.
…19 translation functionality in main.test.ts
…e destructuring for clarity and maintainability.
…tions for cleaner code and improved maintainability. Added Unit tests for updated index.ts
…nce validation. Update index.ts to utilize the new function signature. Add comprehensive unit tests for timeout handling in utils.test.ts and index.test.ts.
Check out PR head refs inside the action, diff source files against the base branch, and patch translated outputs incrementally so locale updates stop failing on dirty worktrees.

Made-with: Cursor
Add an optional base_ref input so branch-restricted workflows can diff source files against an explicit branch such as release/leapfrog instead of relying only on pull request metadata.

Made-with: Cursor
Diff source files against the PR branch's merge-base with the configured base branch so unrelated upstream locale changes are not retransmitted to DeepL.

Made-with: Cursor
Use the workflow repository URL instead of the checked-out fork remote so incremental PR translations compare against the actual base branch and keep an origin fallback when that metadata is unavailable.

Made-with: Cursor
…eprocessing options. Update translateTexts to use replaceParameterStringsInJSONValueWithKeepTags as default preprocess and limit batch size for translations.
tylerthehaas and others added 2 commits March 10, 2026 20:47
…g start/end tags gracefully. Add unit tests to verify behavior for inline no-translate blocks and ensure proper translation of surrounding text.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants