Skip to content

feat: infinite i18n — auto-detect browser language, LLM-powered translations for any language#308

Open
K1skakas wants to merge 18 commits into666ghj:mainfrom
K1skakas:main
Open

feat: infinite i18n — auto-detect browser language, LLM-powered translations for any language#308
K1skakas wants to merge 18 commits into666ghj:mainfrom
K1skakas:main

Conversation

@K1skakas
Copy link
Copy Markdown

Body:
What this does

Replaces the hardcoded Chinese UI with a fully dynamic internationalization system.

How it works

  • Browser auto-detects the user's language via Accept-Language header
  • GET /api/locale/{lang} generates translations for any language on-demand using an LLM
  • Translations cached to backend/app/i18n/{lang}.json — no repeated API calls
  • All AI outputs (ontology, agent personas, simulation posts, reports) also follow the user's language
  • English base locale in backend/app/i18n/en.json — single source of truth
  • vue-i18n@9 handles frontend rendering

vs PR #296
PR #296 adds Chinese + English as hardcoded options. This implementation supports unlimited languages
automatically — no manual translation files needed for each new language.

Tested

  • Hungarian (hu) — full UI translation generated and verified
  • English fallback working
  • Prompt injection protection on language codes

K1skakas and others added 18 commits March 21, 2026 20:30
Translated all Vue frontend components and views from Chinese to English.
This is the first complete EN localization of the MiroFish UI.

- All 15 Vue files translated (views + components)
- docker-compose.yml updated to build locally from source
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add view, steps, and status sections to en.json; wire useI18n into all
5 view files (MainView, SimulationView, SimulationRunView, ReportView,
InteractionView) so view-switcher labels, step names, and status texts
are all driven by locale keys instead of hardcoded English strings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…) keys

- Step1GraphBuild: ontology/graph/build sections, badge labels, stats, log panel header
- Step2EnvSetup: all phase badges, persona/config sections, addLog calls translated to English
- Step3Simulation: report button, event counter, waiting state, monitor label, addLog calls
- Step4Report: prediction report tag, waiting/complete labels, console output, deep interaction btn
- Step5Interaction: interactive tools, survey section, chat placeholders, all Chinese UI strings
- HistoryDatabase: simulation history header, formatRounds(), getSimulationTitle()
- GraphPanel: panel title, refresh, loading/waiting states, legend, edge labels toggle, detail panel
- en.json: added 50+ new keys under graph, simulation, report, interaction, history, env, graph_panel sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nd Step5Interaction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… typographic quotes

- Replace chat_json() with chat() to avoid response_format JSON mode issues
  on free-tier models (gemini-2.0-flash-exp, xiaomi/mimo-v2-pro)
- Add prompt rules to prevent unescaped double-quotes in translated values
  (model was outputting literal " for \"local optimum\" breaking JSON parse)
- Add backend/app volume mount in docker-compose.yml for live Python reload

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Only en.json (base locale) is tracked. All other language files
are auto-generated by locale_generator.py and should not be committed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request labels Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant