Skip to content

Multi-Language (i18n)

TrustRAG supports multiple languages through Flutter's built-in localization system.

Supported Languages

LanguageCodeCoverage
Chinese (Simplified)zh100%
Englishen100%
Japaneseja100%
Koreanko100%

Switching Languages

  1. Go to Settings from the sidebar
  2. Find the Language section
  3. Select your preferred language
  4. The UI updates immediately

Language preference is saved via SharedPreferences and persists across app restarts.

For Developers

Adding a New Language

  1. Create a new ARB file: apps/client/lib/l10n/app_xx.arb (replace xx with the locale code)
  2. Copy all keys from app_en.arb and translate the values
  3. Add the locale to supportedLocales in the app configuration
  4. Run flutter gen-l10n to 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

Released under the Apache 2.0 License.