Skip to content

UI & Localization#376

Open
maximvalerevich wants to merge 6 commits intoTHU-MAIC:mainfrom
maximvalerevich:production-final
Open

UI & Localization#376
maximvalerevich wants to merge 6 commits intoTHU-MAIC:mainfrom
maximvalerevich:production-final

Conversation

@maximvalerevich
Copy link
Copy Markdown
Contributor

@maximvalerevich maximvalerevich commented Apr 6, 2026

Summary

This PR introduces dynamic support for Russian (RU) and Japanese (JA) languages across both the user interface and AI course generation pipelines. Previously, the platform was limited to English and Simplified Chinese, or relied on hardcoded branch overrides. This update allows users to seamlessly select and generate comprehensive course materials, outlines, and interactive content natively in all four supported languages (zh-CN, en-US, ja-JP, ru-RU).

Changes

Core & Types

  • Refactored hardcoded 'zh-CN' | 'en-US' union types into a unified CourseLanguage type alias covering all 4 languages in lib/types/generation.ts.
  • Updated API fallback and validation logic in api/generate/scene-content/route.ts and lib/server/classroom-generation.ts to fully inherit and process the expanded locales.
    UI & Localization
  • Integrated UI translations via ru-RU.json and verified registration in lib/i18n/locales.ts.
  • Upgraded the language selection button in GenerationToolbar from a binary toggle to a cyclical 4-state selector.
  • Enhanced browser locale detection on the homepage (app/page.tsx) to properly identify and assign default languages for ru and ja browser locales.
  • Added localized TTS audio preview strings ("Добро пожаловать в AI-класс", "AIクラスルームへようこそ") in agent-bar.tsx.
    AI Generation Logic & Prompts
  • prompt-builder.ts: Expanded language constraint injection to pass readable names (e.g., "Russian (Русский)") directly into the AI agent personas.
  • scene-generator.ts: Replaced hardcoded Chinese fallback text (e.g., "无可用图片,禁止插入任何 image 元素") with English equivalents to ensure language-agnostic AI comprehension regardless of the target generation language.
  • pbl-system-prompt.ts: Injected a critical LANGUAGE REQUIREMENT directive into the English project-based learning prompt to strictly enforce RU/JA content generations without relying on the Chinese templates.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. https://open-maic-nu.vercel.app

What you personally verified

Evidence

  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally
  • Screenshots / recordings attached (if UI changes)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • My changes do not introduce new warnings

- Create lib/i18n/locales/ru-RU.json with full Russian translation (878 keys)
- Register ru-RU in lib/i18n/locales.ts (code: 'ru-RU', label: 'Русский', shortLabel: 'RU')
- No AI prompt modifications — follows new i18next-based architecture
…line, and interactive classroom stage components
…ider support for TTS, ASR, image, and video generation, including settings management and i18n.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant