feat(i18n): Backend locale support for LLM-generated content#245
Open
pjhoberman wants to merge 5 commits into666ghj:mainfrom
Open
feat(i18n): Backend locale support for LLM-generated content#245pjhoberman wants to merge 5 commits into666ghj:mainfrom
pjhoberman wants to merge 5 commits into666ghj:mainfrom
Conversation
Add internationalization support to the MiroFish frontend with Chinese (zh-CN) as the default language and English (en) as an alternative, switchable via a toggle button in the header. Changes: - Install vue-i18n and configure with Composition API mode - Create zh-CN and en locale files with ~262 translation keys - Add useLocaleToggle composable for shared language toggle logic - Replace hardcoded Chinese strings with $t() calls across all 14 Vue components and 7 views - Add language toggle button to all page headers - Persist language preference in localStorage - Configure Vite @ path alias for clean imports Chinese regex patterns that parse backend LLM responses are intentionally preserved unchanged (Step4Report.vue, Step2EnvSetup.vue). Also fixes API base URL to use window.location.hostname instead of hardcoded localhost, enabling remote access. Closes 666ghj#117 Closes 666ghj#182 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Home page navbar is transparent (not dark as assumed), so the white-on-transparent button was invisible. Use explicit light gray background with dark text for guaranteed visibility on any background. Also increase button size across all views for better discoverability. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass the user's language preference (from Accept-Language header) through the backend to all LLM prompt generation, so agent profiles, simulation configs, and prediction reports are generated in the user's chosen language. Changes: - Frontend: attach Accept-Language header to all API requests via axios interceptor (reads from localStorage mirofish-locale) - Backend: new app/utils/i18n.py with locale helpers - Profile generator: bilingual prompts for individual and group personas - Report agent: English versions of plan, section, and chat prompts - Simulation config generator: bilingual time/event/agent config prompts - Interview prompt: locale-aware prefix - API routes: capture locale before background threads, pass through the entire call chain Locale flow: API endpoint -> captured before thread -> SimulationManager -> OasisProfileGenerator / SimulationConfigGenerator / ReportAgent Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Time/event/agent config progress messages and reasoning labels were hardcoded in Chinese. Now locale-aware. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ReportLogger: all log messages now bilingual (planning start/complete, section start, react thought, report complete) - generate_report(): all progress callbacks bilingual - Step4Report.vue: panorama/insight/interview/search display labels translated via $t() calls (active memories, historical memories, entities, expand/collapse, tabs, etc.) - Added 28 new step4.* locale keys for tool result UI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the frontend i18n work from #244 to the backend — LLM-generated content (agent profiles, simulation configs, prediction reports) and all progress/status messages now respect the user's language preference.
Depends on: #244 (frontend i18n with vue-i18n)
How it works
Accept-Languageheader to every API request (via axios interceptor)What's translated
Files changed (11)
frontend/src/api/index.js- Attach Accept-Language header via interceptorfrontend/src/components/Step4Report.vue- Tool result labels via t() callsfrontend/src/i18n/locales/en.js- +28 new step4 keysfrontend/src/i18n/locales/zh-CN.js- +28 matching Chinese keysbackend/app/utils/i18n.py- NEW locale helpersbackend/app/services/oasis_profile_generator.py- Bilingual persona promptsbackend/app/services/report_agent.py- English prompt templates + bilingual logger/progressbackend/app/services/simulation_config_generator.py- Bilingual config prompts + progress labelsbackend/app/services/simulation_manager.py- Pass locale through to generatorsbackend/app/api/simulation.py- Capture locale, bilingual interview prefixbackend/app/api/report.py- Capture locale at report/chat endpointsTest plan
Closes #117