Multi-Language (i18n)
TrustRAG supports multiple languages through Flutter's built-in localization system.
Supported Languages
| Language | Code | Coverage |
|---|---|---|
| Chinese (Simplified) | zh | 100% |
| English | en | 100% |
| Japanese | ja | 100% |
| Korean | ko | 100% |
Switching Languages
- Go to Settings from the sidebar
- Find the Language section
- Select your preferred language
- The UI updates immediately
Language preference is saved via SharedPreferences and persists across app restarts.
For Developers
Adding a New Language
- Create a new ARB file:
apps/client/lib/l10n/app_xx.arb(replacexxwith the locale code) - Copy all keys from
app_en.arband translate the values - Add the locale to
supportedLocalesin the app configuration - Run
flutter gen-l10nto generate the localization delegate
ARB File Structure
Translation files use the Application Resource Bundle (ARB) format:
json
{
"appName": "TrustRAG",
"navChat": "Chat",
"navDocuments": "Documents",
"loadFailed": "Load failed: {error}",
"@loadFailed": { "placeholders": { "error": { "type": "String" } } }
}Using Translations in Code
dart
import '../../../l10n/app_localizations.dart';
// In a widget:
final s = S.of(context);
Text(s.navChat); // Simple string
Text(s.loadFailed(error)); // Parameterized string