# Internationalization Support (Work vs UI Language)

Chinese version: [中文版](./i18n.zh.md)

Dominds has two independent language settings:

## 1) Work language (server-wide)

- **What it affects:** agent system prompts, internal guide messages, inter-dialog (teammate/sideDialog) narrative formatting.
- **How to set:** standard locale environment variables (`LANG`).
- **Default:** OS default language (best-effort); falls back to `en`.
- **Supported (v1):**
  - `en`
  - `zh`

### Agent mindset loading (file preference)

When loading an agent mindset document (e.g. `persona`, `knowhow`, `pitfalls`), prefer the work-language-specific filename first, then follow the per-kind fallback order:

1. `persona.<workLanguageCode>.md` (e.g. `persona.en.md` when work language is `en`)
2. `persona.md`
3. `knowhow.<workLanguageCode>.md` → `knowhow.md`
4. `pitfalls.<workLanguageCode>.md` → `pitfalls.md`

Examples:

```bash
# Dev server (outer rtws)
LANG=zh_CN.UTF-8 ./dev-server.sh

# Production WebUI server (dominds CLI)
LANG=en_US.UTF-8 dominds webui
```

## 2) UI language (per WebUI client)

- **What it affects:** WebUI UI copy + the language the agent is asked to use when replying to the current user.
- **What it does NOT affect:** the agent’s internal working language, system prompts, or teammate/sideDialog formatting language.
- **How to set:** WebUI dropdown in the top-right (stored in `localStorage` as `dominds-ui-language`).
- **Supported (v1):** `en`, `zh`.

### Per-prompt language preference (multi-client safe)

Every user prompt sent from WebUI to backend carries `userLanguageCode` (derived from the sender’s UI language at send time).

Backend stores this on the `Dialog` as `lastUserLanguageCode` for the current drive, so different clients can alternate languages in the same dialog and the agent is expected to follow the latest prompt’s preference when generating the next reply.
