Skip to content

FE-M0-14 · The user's language: profile, cookie and the ID | EN toggle; then merge pack D

ID FE-M0-14 · Level L0 · Run order row 28

Each user sees the app in the language on their profile (D7, D29); the ID | EN toggle in the top bar saves it with set_my_locale() (FE-R5) and in the opleet-locale cookie; client components get one language only; pack D is merged.

  • FE-M0-13 is Done. You are on the branch web/languages.
  • The local stack is running with BE pack B (profiles.locale and set_my_locale()) and the E2E logins. Nothing else runs on port 3000.

1 · Copy this step's files; lib/i18n/client.ts becomes client.tsx, now that it holds the provider

Section titled “1 · Copy this step's files; lib/i18n/client.ts becomes client.tsx, now that it holds the provider”
Terminal window
git rm -q apps/web/lib/i18n/client.ts
cp -R ~/opleet-v2/packs/fe-pack-d/FE-M0-14/. .
git status --short

2 · Write the catalog again, then test, typecheck, lint and build

Section titled “2 · Write the catalog again, then test, typecheck, lint and build”
Terminal window
pnpm --filter web i18n
pnpm --filter web test
pnpm --filter web typecheck
pnpm lint
pnpm --filter web build
Terminal window
pnpm --filter web dev

4 · In the browser, sign in at http://localhost:3000 as the E2E finance login. Press EN in the top bar, then reload. Sign out, and sign in again with a wrong password.

Section titled “4 · In the browser, sign in at http://localhost:3000 as the E2E finance login. Press EN in the top bar, then reload. Sign out, and sign in again with a wrong password.”

5 · In a private window, sign in as the same login: the language comes from the profile. Press ID there, then stop the app with Ctrl+C.

Section titled “5 · In a private window, sign in as the same login: the language comes from the profile. Press ID there, then stop the app with Ctrl+C.”

6 · Commit, push, open the pull request, merge

Section titled “6 · Commit, push, open the pull request, merge”
Terminal window
git add -A apps/web
git commit -m "feat(web): the user's language, saved on the profile"
git push -u origin web/languages
gh pr create --title "feat(web): the app in Indonesian and English" --body "FE pack D (FE-M0-12 to FE-M0-14), timeline row 28."
gh pr checks --watch
gh pr merge --squash --delete-branch
git switch main
git pull
  • Block 1: M for apps/web/AGENTS.md, app/(shell)/layout.tsx, app/design-preview/page.tsx, app/layout.tsx, components/shell/Shell.tsx, i18n/messages.en.ts, i18n/strict.json, lib/auth/actions.ts and lib/i18n/server.ts; D apps/web/lib/i18n/client.ts; ?? for components/shell/LanguageSwitcher.tsx, lib/i18n/actions.ts and lib/i18n/client.tsx.
  • Block 2: “Keys: 88. With English: 88. Without: 0.”; “ℹ pass 33”; no type errors; “No fixes applied.”; the build lists the same routes as FE-M0-10.
  • Block 4: EN turns the menu, the top bar and the tab title to English (Collection · Opleet), like expected/d-english.png, and it stays after the reload. After sign-out the sign-in page is in English, and the wrong password says “Wrong email or password.”, like expected/d-login-en.png.
  • Block 5: the private window opens in English. ID turns it back to Indonesian.
  • Block 6: checks and pr-title pass, then “✓ Squashed and merged pull request #…”.
Terminal window
git log --oneline -1

Expect: “feat(web): the app in Indonesian and English (#…)”.

  • Pressing EN shows a red toast instead: its text is the database's refusal, read through the mapper (for example “Sesi Anda sudah berakhir. Masuk lagi.”). Paste it.
  • The private window opens in Indonesian: set_my_locale() didn't keep en on the profile. Paste the first terminal's last lines.
  • A text stays Indonesian in English: that key has no English yet. pnpm --filter web i18n lists such keys; paste the text.
Terminal window
gh pr close --delete-branch
git switch main
git branch -D web/languages

Before merging. After merging: revert it with a new pull request.

Not run yet.