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 · Check the files this step replaces, then copy its files; lib/i18n/client.ts becomes client.tsx, now that it holds the provider

Section titled “1 · Check the files this step replaces, then copy its files; lib/i18n/client.ts becomes client.tsx, now that it holds the provider”

The zip's components/shell/Shell.tsx is the whole new shell: it imports LanguageSwitcher and puts it in the top bar, after the pool switcher.

Terminal window
shasum -a 256 -c ~/opleet-v2/packs/fe-pack-d/FE-M0-14/BASE.sha256 &&
git rm -q apps/web/lib/i18n/client.ts &&
cp -R ~/opleet-v2/packs/fe-pack-d/FE-M0-14/apps . &&
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: eleven lines ending in “: OK”, then M for apps/web/AGENTS.md, app/(shell)/layout.tsx, app/app.css, 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: 90. With English: 90. 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), and it stays after the reload; the switcher shows two equal halves, with the white thumb under the selected language. After sign-out the sign-in page is in English, and the wrong password says “Wrong email or password.”.
  • 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 (#…)”.

The shell's and the preview's layout stay utilities (D35). Before block 6 opens the pull request, run the three greps from FE-M0-10, with apps/web/app/design-preview added to the folders. Expect: the first lists one line, in components/shell/LanguageSwitcher.tsx, the switcher thumb's position (a runtime value); the second and third print nothing.

  • 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.
  • Block 1 prints “FAILED” for a file and stops: your copy of that file is not the one this step was written for (main has changed it, or it was edited by hand). Nothing was copied. Paste the FAILED lines and stop; FE rebuilds the step. If you fixed files by hand on an earlier try, start again from main: run FE-M0-12's Undo, then FE-M0-12 from block 2.
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.