Skip to content

feat(i18n): add multi-language support (zh/en/de)#398

Closed
kevin-hillman wants to merge 1 commit into666ghj:mainfrom
kevin-hillman:feat/i18n
Closed

feat(i18n): add multi-language support (zh/en/de)#398
kevin-hillman wants to merge 1 commit into666ghj:mainfrom
kevin-hillman:feat/i18n

Conversation

@kevin-hillman
Copy link
Copy Markdown

Summary

Add a complete internationalization (i18n) system that enables MiroFish to run in Chinese (default), English, or German via a single LANGUAGE environment variable.

  • Backend: New app/i18n/ module with language-specific files for all prompt templates, to_text() format strings, UI strings, and regex patterns. All services updated to use get_prompt(), get_format(), get_string() instead of hardcoded strings.
  • Frontend: Locale JSON files (zh.json, en.json, de.json) with 240 keys each, plus a loader module with t() function.
  • API: New /api/config/language and /api/config/patterns endpoints so the frontend can adapt to the configured language.
  • Backward compatible: Chinese remains the default; existing installations are unaffected.

How to use

# In .env, add:
LANGUAGE=en   # Options: zh (default), en, de

Files changed

Area Files Description
i18n module 4 new files __init__.py, zh.py, en.py, de.py (~4000 lines)
Frontend locales 4 new files zh.json, en.json, de.json, index.js
Backend services 7 modified Updated to use i18n accessors
Config 3 modified .env.example, config.py, __init__.py
API 1 new file config_api.py with language/patterns endpoints

Why this matters

MiroFish has growing international interest. This PR makes it accessible to English and German speakers without forking, while keeping the Chinese experience identical. Adding more languages is straightforward -- just create a new language file following the existing pattern.

Test plan

  • Verify LANGUAGE=zh produces identical output to current behavior
  • Verify LANGUAGE=en produces English prompts, reports, and UI
  • Verify LANGUAGE=de produces German prompts, reports, and UI
  • Verify /api/config/language returns the configured language
  • Verify /api/config/patterns returns language-appropriate regex patterns
  • Run a full simulation pipeline in each language

Add a complete internationalization system that supports Chinese (default),
English, and German via the LANGUAGE environment variable.

Backend:
- Add backend/app/i18n/ module with language loader and accessor functions
- Extract all prompt templates, format strings, UI strings, and regex
  patterns into language-specific files (zh.py, en.py, de.py)
- Update all services to use i18n: report_agent, zep_tools,
  ontology_generator, simulation_config_generator, oasis_profile_generator,
  zep_graph_memory_updater
- Add /api/config/language and /api/config/patterns endpoints

Frontend:
- Add frontend/src/i18n/ with locale JSON files (zh/en/de, 240 keys each)
- Add language loader with t(), setLanguage(), initLanguage() functions

Configuration:
- Add LANGUAGE=zh to .env.example (options: zh, en, de)
- Chinese remains the default for backward compatibility

This enables the MiroFish community to use the platform in their
preferred language and makes it easy to add more languages.
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request labels Mar 30, 2026
@666ghj
Copy link
Copy Markdown
Owner

666ghj commented Apr 2, 2026

The project already has i18n support in place — please refer to [PR #428] for reference.

@666ghj 666ghj closed this Apr 2, 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.

2 participants