feat: i18n support via Accept-Language header (en, id)#26
Merged
Conversation
Adds an AsyncLocalStorage-backed translation layer (`t()` + `translateValidationIssue`) wired through the error handler, auth/authorization plugins, every route handler, every service-layer error, and the mail pipeline (including a `lang` BullMQ payload + locale-suffixed email templates) so all user-facing copy and outbound emails honor the request's Accept-Language. Documents the header globally in the OpenAPI spec and gates locale-key drift via `i18n:keys` in the pre-commit hook. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
t()+translateValidationIssue) sourced from per-locale JSON dictionaries and an auto-generatedTranslationKeyunion (bun run i18n:keys).Accept-Languageheader (defaulten), echoed back viaContent-Language, propagated through every route handler, service, error, validation message, and the BullMQ email pipeline (langis stamped on the job payload and the worker re-enters the locale before rendering).<template>.<locale>.htmlwith English fallback), Accept-Language documented globally in the OpenAPI/Scalar spec, andbun run i18n:keysis now in the pre-commit hook so missing/extraid.jsonkeys fail commits.Test plan
bun run typecheckandbun run lintare clean.Accept-Language: idand confirm the success/error message andContent-Language: idheader./auth/register) withAccept-Language: idand confirm field-level messages render in Indonesian.Accept-Language: idand confirm the verification email usesemail-verification.id.htmland the Indonesian subject./reference(Scalar) and confirm every route lists theAccept-Languageheader parameter.en.jsonwithout mirroring it inid.jsonand confirmbun run i18n:keysexits non-zero (pre-commit will catch it).\U0001F916 Generated with Claude Code