Skip to content

feat(i18n): add internationalization infrastructure#2106

Open
Ridanshi wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Ridanshi:codex/issue-1082-i18n
Open

feat(i18n): add internationalization infrastructure#2106
Ridanshi wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Ridanshi:codex/issue-1082-i18n

Conversation

@Ridanshi
Copy link
Copy Markdown
Contributor

@Ridanshi Ridanshi commented Jun 6, 2026

Closes #1082

Architecture decision

DevTrack uses the Next.js App Router with a single root layout, client providers, custom auth/rate-limit middleware, and Supabase-backed user settings. next-intl was selected because it fits App Router server/client rendering, supports request-scoped message loading, and avoids a disruptive route-prefix migration.

Locale strategy

Supported locales are English (en) and Spanish (es). Routes remain unprefixed for this foundation. Locale metadata includes direction so RTL languages can be added later without changing the provider shape.

Persistence strategy

Authenticated language preference is stored as users.preferred_locale through the existing settings API and mirrored into a devtrack-locale cookie. The cookie lets pre-auth and server-rendered pages pick the active locale quickly, while the database setting survives refresh, login, and other devices once settings are loaded.

Fallback behavior

Locale resolution priority is user preference, then cookie, then browser Accept-Language, then English. Message loading merges locale messages over English so missing translated keys fall back to English and rendering does not break.

Supported languages

  • English
  • Spanish

Files changed

  • Added next-intl config, request helpers, locale metadata, detection, and lookup helpers.
  • Added messages/en.json and messages/es.json.
  • Wired the root layout and middleware for locale context and detection.
  • Added preferred_locale persistence to settings API and migration.
  • Added the Settings language dropdown.
  • Externalized focused navigation, dashboard, settings, auth, achievement, common button, and common label strings.

Tests added

  • Locale detection priority and fallback tests.
  • Translation lookup, Spanish rendering, and missing-key behavior tests.
  • Settings API locale persistence and validation tests.
  • Dashboard header provider coverage update.

Verification commands

  • corepack pnpm lint
  • corepack pnpm typecheck (not defined; repo uses type-check)
  • corepack pnpm type-check
  • corepack pnpm test test/i18n.test.ts test/user-settings-api.test.ts test/useUserSettings.test.tsx test/components/DashboardHeader.test.tsx
  • corepack pnpm test

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

@Ridanshi is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) labels Jun 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR uses pnpm-lock.yaml and pnpm-workspace.yaml, but the project uses npm (package-lock.json). This would break npm ci in CI. Please switch to npm and regenerate the lock file, and also confirm no existing routes break with the locale routing change.

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

CI is failing on this PR (Type check, Lint, Build). Please fix the errors and push an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: i18n / internationalization support (multi-language)

2 participants