Skip to content

feat: i18n support via Accept-Language header (en, id)#26

Merged
zulfikar-ditya merged 1 commit into
aolus-software:mainfrom
zulfikar-ditya:main
May 16, 2026
Merged

feat: i18n support via Accept-Language header (en, id)#26
zulfikar-ditya merged 1 commit into
aolus-software:mainfrom
zulfikar-ditya:main

Conversation

@zulfikar-ditya
Copy link
Copy Markdown
Member

Summary

  • Implements an AsyncLocalStorage-backed translation layer (t() + translateValidationIssue) sourced from per-locale JSON dictionaries and an auto-generated TranslationKey union (bun run i18n:keys).
  • Locale is selected per request from the Accept-Language header (default en), echoed back via Content-Language, propagated through every route handler, service, error, validation message, and the BullMQ email pipeline (lang is stamped on the job payload and the worker re-enters the locale before rendering).
  • Bilingual email templates (<template>.<locale>.html with English fallback), Accept-Language documented globally in the OpenAPI/Scalar spec, and bun run i18n:keys is now in the pre-commit hook so missing/extra id.json keys fail commits.

Test plan

  • bun run typecheck and bun run lint are clean.
  • Hit any endpoint with Accept-Language: id and confirm the success/error message and Content-Language: id header.
  • Trigger a 422 validation error (e.g. invalid email on /auth/register) with Accept-Language: id and confirm field-level messages render in Indonesian.
  • Register a user with Accept-Language: id and confirm the verification email uses email-verification.id.html and the Indonesian subject.
  • Open /reference (Scalar) and confirm every route lists the Accept-Language header parameter.
  • Add a key to en.json without mirroring it in id.json and confirm bun run i18n:keys exits non-zero (pre-commit will catch it).

\U0001F916 Generated with Claude Code

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>
@zulfikar-ditya zulfikar-ditya merged commit eb95c99 into aolus-software:main May 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant