> **Draft** — auto-generated by roll-doc on 2026-05-28. Review before treating as authoritative.

# lib/i18n/ — Localized string tables

All user-visible CLI output strings for both `en` and `zh` locales, organized by command domain.

## Structure

Each `.sh` file under `lib/i18n/` is a shell associative-array fragment exporting a `MSG_*` namespace:

```
lib/i18n/
├── agent.sh          # roll agent use / install messages
├── alert.sh          # ALERT lifecycle messages
├── backlog.sh        # backlog read/write output
├── brief.sh          # roll-brief generation output
├── changelog.sh      # changelog sync messages
├── ci.sh             # CI self-heal messages
├── debug.sh          # roll debug diagnostics
├── doctor.sh         # roll-doctor check output
├── dream.sh          # roll-.dream scan output
├── init.sh           # roll init setup messages
├── lang.sh           # locale detection + ROLL_LANG resolution
├── loop.sh           # roll loop subcommand output (largest file)
├── offboard.sh       # roll offboard output
├── onboard.sh        # roll onboard / legacy-onboard output
├── peer.sh           # roll peer review messages
├── peer_help.sh      # peer --help text
├── peer_reset.sh     # peer reset confirmation messages
├── peer_status.sh    # peer status output
├── prices_refresh.sh # prices refresh output
└── skills/           # per-skill i18n overrides
```

## Locale selection

`ROLL_LANG` env var controls which locale is active. Resolved by `lang.sh`:

1. `ROLL_LANG` explicit → use it
2. `LC_ALL` / `LANG` contains `zh` → `zh`
3. Default → `en`

Each `.sh` file branches on `ROLL_LANG` and exports the appropriate string set.

## skills/

Per-skill message overrides for `roll-build`, `roll-design`, `roll-fix`, `roll-loop`, `roll-onboard`. Same structure as top-level files — sourced after the base file to allow skill-specific overrides without editing shared strings.

## Adding a new string

1. Add the key to both `en` and `zh` branches in the appropriate domain file.
2. Reference via `msg <KEY>` in `bin/roll` or the relevant skill.
3. Never hardcode user-facing strings in `bin/roll` directly — always go through i18n.
