Repository navigation
feat(deepl): add @kiritan/deepl translate middleware - #53
Merged
Merged
Conversation
7 of 10 tasks
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The request options can disable placeholder protection, batching ignores DeepL’s body-size limit, and the documented catalog example contains no translatable catalog segments.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds a standalone @kiritan/deepl translation middleware with single and batch request modes, placeholder preservation, tests, packaging, documentation, and release automation.
Changes:
- Implements DeepL translation requests, language mapping, XML-safe placeholders, and batching.
- Adds unit tests, package metadata, build configuration, lockfile, and release workflow.
- Updates localized documentation, design notes, contributor guidance, and workspace configuration.
| File | Description |
|---|---|
README.md |
Lists the new package. |
README.ja.md |
Japanese package listing. |
packages/deepl/tsdown.config.ts |
Package build configuration. |
packages/deepl/tsconfig.json |
TypeScript configuration. |
packages/deepl/src/index.ts |
DeepL middleware implementation. |
packages/deepl/src/index.test.ts |
API and batching tests. |
packages/deepl/README.md |
English package documentation. |
packages/deepl/README.ja.md |
Japanese package documentation. |
packages/deepl/package.json |
Package metadata and exports. |
packages/deepl/LICENSE |
Package license. |
packages/deepl/base/README.base.md |
Localized README source. |
package-lock.json |
Workspace lockfile update. |
docs/DESIGN.md |
English architecture and roadmap updates. |
docs/DESIGN.ja.md |
Japanese architecture and roadmap updates. |
CONTRIBUTING.md |
English package and release guidance. |
CONTRIBUTING.ja.md |
Japanese package and release guidance. |
base/README.base.md |
English/Japanese workspace README source updates. |
base/DESIGN.base.md |
Design documentation source updates. |
base/CONTRIBUTING.base.md |
Contribution documentation source updates. |
.kiritanconfig |
Registers package documentation generation. |
.github/workflows/release-deepl.yml |
Adds package release workflow. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…uest size, and use a sidecar README example
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Summary
Adds
@kiritan/deepl, the first official translate-middleware package from the roadmap.deepl(options)is a single-form middleware (one request per item).deeplBatch(options)is a batch-form one: contexts sharing a language pair go out together, up to DeepL's 50 texts per request.%{name}placeholders come back unchanged. They are wrapped in a tag DeepL is told to ignore (tag_handling: xml+ignore_tags), so the rest of the text is XML-escaped on the way in and un-escaped on the way out.en/pttargets map toEN-US/PT-BRsince DeepL rejects the bare codes as a target.targetLanguagesoverrides this per locale, andextraParamsis merged into the request body.kiritan: a middleware is just a function, and the types are declared structurally.release-deepl.ymlworkflow (same shape asrelease-runtime.yml), and entries in the docs tables. The version starts at0.0.0, so the firstminorrelease gives0.1.0.Not verified against the live service: I have no DeepL key. The request shape (endpoint, auth header, body fields, response handling, 50-text limit) is unit-tested against DeepL's documented API with a fake
fetch, so please try it once with a real key before the first release.@kiritan/google-translateis still on the roadmap. Trusted publishing for@kiritan/deeplalso needs setting up on npmjs.com before its first release (see CONTRIBUTING.md).Why?
DESIGN.md chapter 13 listed official translate-middleware packages as future work, and the README/DESIGN wording said only doc examples would exist in v1.
Related issue(s)
closes
Check
CONTRIBUTING.md(rules)npm run check(lint & format)npm run typechecknpm run test(functions test)npm run build(dist/)npm run test:coverageand check nothing new went uncovered