i18n & Localization
Relevant source files
The following files were used as context for generating this wiki page:
The i18n (Internationalization) and Localization system in mausVoice is designed to provide a multi-language user interface and transcription support. The system utilizes react-intl for frontend message management and integrates localized preferences into the underlying SQLite database to ensure a consistent experience across different regions and languages.
The architecture follows a "TypeScript is the Brain" pattern where localization logic, message extraction, and synchronization are managed within the desktop application's frontend layer, while the Rust backend maintains persistence for user-preferred languages.
Sources: llms.txt, apps/desktop/README.md:41-45
Core Framework and Tools
The project leverages react-intl from the FormatJS suite to handle internationalization. This includes automatic message ID generation and structured translation catalogs.
Development Scripts
Developers interact with the i18n system through a set of automated scripts defined in the desktop application's configuration.
| Command | Description |
|---|---|
pnpm run i18n:extract | Extracts messages from React components into en.json. |
pnpm run i18n:sync | Synchronizes keys from the English source to other locale files. |
pnpm run i18n | Orchestrates both extraction and synchronization in sequence. |
Sources: apps/desktop/package.json:18-20, apps/desktop/README.md:82-88
Implementation Patterns
To maintain consistency and avoid manual ID management, the project enforces specific coding patterns:
- Components: Use the
<FormattedMessage defaultMessage="..." />component. - Hooks: Use the
useIntl()hook for imperative string formatting. - Constraint: Developers must never pass a manual
idprop toFormattedMessage; IDs are auto-generated during extraction.
Sources: CLAUDE.md:18-19, AGENTS.md:18-19, apps/desktop/README.md:92-95
Architecture and Data Flow
The i18n system operates across the TypeScript frontend and the Rust/SQLite backend. User preferences for language are persisted in the database, while the UI reacts to these changes via the Zustand state store.
The diagram shows how localized strings are retrieved from JSON catalogs while user language preferences are synced through the Rust API to SQLite.
Sources: llms.txt:38-46, apps/desktop/README.md:41-45
Localization Persistence
The system includes multiple database migrations to handle language-specific user preferences. This ensures that the application remembers the user's choice of dictation and interface language across sessions.
Key Database Schema Elements
Specific migrations have been implemented to track language settings:
USER_PREFERRED_LANGUAGE_MIGRATION_SQL: Stores the primary interface language.ADDITIONAL_DICTATION_LANGUAGES_MIGRATION_SQL: Manages secondary languages for transcription support.LANGUAGE_SWITCH_MIGRATION_SQL: Handles logic for switching between active languages.
Sources: apps/desktop/src-tauri/src/db/mod.rs:38-39, apps/desktop/src-tauri/src/db/mod.rs:88-89, apps/desktop/src-tauri/src/db/mod.rs:104-105
Multi-Language Transcription Support
Beyond UI localization, mausVoice supports transcription and AI post-processing in multiple languages. Test suites verify that the AI cleanup and writing styles remain effective in languages including:
- German (
de) - Spanish (
es) - French (
fr) - Simplified Chinese (
zh) - Portuguese (
pt)
Transcription Data Flow
The sequence illustrates how the dictationLanguage parameter is passed to AI providers to ensure accurate localized transcription and post-processing.
Sources: apps/desktop/test/evals/post-processing-eval.test.ts:39-44, apps/desktop/test/evals/post-processing-eval.test.ts:327-360
Conclusion
The i18n & Localization system in mausVoice provides a robust framework for managing multi-language support. By combining react-intl for frontend message handling with SQLite for preference persistence, the application ensures that both the user interface and the core voice-to-text functionality are accessible to a global audience. The automated extraction and synchronization scripts further streamline the development process, maintaining high code quality and consistency.