feat(T-29): add UI localization with PT/EN support#65
Conversation
- Add i18n object in app.js with Portuguese and English string maps - Add applyLocale() function to localise all user-visible text - Add detectLanguage() that reads navigator.language on page load - Add playwright for browser-level JS testing - Add BDD feature file and step definitions for localization scenarios - Add init path tests verifying locale is applied on startup Co-authored-by: claude <claude@anthropic.com>
|
🤖 This PR was automatically generated by the auto-implement workflow using OpenCode CLI with the big-pickle model. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The test job runs Playwright-based tests but never installs the Chromium browsers, causing all UI localization tests to fail. Add 'playwright install chromium' step before running pytest. Co-authored-by: opencode <noreply@opencode.ai>
The mutation job runs pytest through check_mutation_score.py, which now includes Playwright-based tests. Add browser install so mutation tests don't fail with missing executable. Co-authored-by: opencode <noreply@opencode.ai>
Add a globe+text language toggle to cycle between PT and EN, matching the theme toggle style. Toggle preference is persisted in localStorage, and detectLanguage() checks saved preference before falling back to navigator.language. Co-authored-by: opencode <noreply@opencode.ai>
Append git commit hash as query parameter to app.js URL in preview builds so browsers fetch the latest version instead of serving a stale cached copy. Co-authored-by: opencode <noreply@opencode.ai>
Remove the globe SVG from the language toggle and use just the language code (EN/PT) so the button matches the theme toggle size. Co-authored-by: opencode <noreply@opencode.ai>
Move Portuguese and English string maps from a single i18n
object in app.js to dedicated files under app/static/js/i18n/:
i18n/en.js — English strings
i18n/pt.js — Portuguese strings
i18n/loader.js — detectLanguage() and applyLocale()
(exposed on globalThis)
Update index.html to load the three scripts before app.js.
Update preview.yml build step to copy the i18n subdirectory.
Co-authored-by: opencode <noreply@opencode.ai>
💡 AI Code ReviewHere are some automated review suggestions for this pull request. Reviewed commit: ℹ️ About this reviewThis review was generated automatically by the AI Code Review workflow using OpenCode CLI with the Minimax M2.5 Free model. Reviews are triggered on every pull request push. |
|
| (function () { | ||
| const i18n = globalThis.__i18n || {}; | ||
|
|
||
| function detectLanguage() { |
There was a problem hiding this comment.
localStorage overrides
navigator.language on page load
The task says detection should use navigator.language on page load. detectLanguage() checks localStorage.getItem('lang') first — meaning if a user previously toggled language, the saved value takes priority on every subsequent load, not just on explicit toggle. This is fine for the toggle feature but violates the stated detection logic for initial page load.
| if (langText) langText.textContent = globalThis.__currentLang.toUpperCase(); | ||
| if (langToggle) { | ||
| langToggle.addEventListener('click', () => { | ||
| const next = globalThis.__currentLang === 'pt' ? 'en' : 'pt'; |
There was a problem hiding this comment.



Task/Issue
T-29 · UI localization (PT / EN)
What?
Why?