/wbTranslate — Exhaustive Simulation ()
/wbTranslate is the i18n bootstrap. Its job is to lift hardcoded user-facing strings into a translation file, leaving placeholders in the original code, and producing a localization-ready scaffold. It does not invent translations; it does not produce localized variants; it sets up the infrastructure for translation work.
Read this if you want to know what counts as a "user-facing string," why /wbTranslate has only one flag, and where translation bootstrap ends and translation content begins.
1. Role & target
| Aspect | Behavior |
|---|---|
| Role | The Translator — i18n scaffolding, not localized content. |
| Target | A file or directory containing user-facing strings. |
| Cell scope | None. |
| Side effects allowed | Editing source code (replace hardcoded strings with t('key') calls); creating/updating i18n/<locale>.json or equivalent; producing a glossary file for the translation team. |
| Side effects forbidden | Inventing translations; producing localized variants without explicit --new-only opt-in; modifying tests; touching code that isn't user-facing. |
The "no invented translations" rule is the contract. The tooling job is mechanical: find strings, key them, replace with calls. The content job (translating "Submit" to "Soumettre") is human work, or a different model run with the right context. Mixing the two produces fake-looking localizations that nobody trusts.
2. Argument resolution matrix
| Form | Example | What /wbTranslate does |
|---|---|---|
| File | Command: /wbTranslate src/components/LoginForm.vue | Scans for user-facing strings; lifts them into the locale file; replaces with t() calls. |
| Directory | Command: /wbTranslate src/components/ | Walks the directory; one locale file aggregating all keys. |
| Free-text | Command: /wbTranslate "the login flow" | Refused. Translation is path-required (string-extraction needs file scope). |
What counts as a "user-facing string"
A heuristic, applied per file type:
| Context | String is user-facing if... |
|---|---|
| Vue/React component template | It appears as text content of a DOM element, or as a placeholder / aria-label / title attribute. |
| Vue/React script section | It's passed to a known UI emitter (toast, alert, error throw with user-visible message). |
| Form labels, button text | Always user-facing. |
| Console.log / debug | Never user-facing — left alone. |
| Error messages thrown to internal callers | Not user-facing — left alone. |
| URLs, regex patterns, technical constants | Never user-facing — left alone. |
The heuristic is conservative: when uncertain, leave the string alone and surface it as a "candidate?" question rather than auto-extracting.
3. Flag matrix
/wbTranslate has one flag.
| Flag | Shortcut | Purpose |
|---|---|---|
--new-only | -n | Only extract strings that aren't already in the locale file. Skip already-keyed content. |
Without --new-only, every user-facing string in the target gets re-keyed (with collision handling — same string maps to same key). With --new-only, the agent assumes existing keys are correct and only adds new ones.
The -n flag is for the maintenance case: someone added 3 new strings to a component that's already partially translated. You don't want to re-key the existing 20; you want only the 3 new ones.
4. Pipelines (the agent-native scenarios)
/wbTranslate core2/packages/wb-core/src/components/LoginForm.vue> /wbTranslate core2/packages/wb-core/src/components/LoginForm.vue💠 Pipeline First-time bootstrap of a component
💠 Pipeline Maintenance pass with --new-only
After Pipeline A, the developer adds 2 new strings to LoginForm.vue. Running again:
💠 Pipeline Refusal on ambiguous case
A user runs /wbTranslate on a file mostly full of error strings:
5. Edge cases & refusals
| Trigger | What /wbTranslate does |
|---|---|
| No target | Halt. |
| Free-text target | Halt — file/directory required. |
| Target has no user-facing strings | One-line "nothing to translate." Exit 0. |
| Target with mixed locales already | Refuse — running /wbTranslate on a partially-translated file is risky without -n. Suggests re-running with --new-only. |
| String contains placeholders / interpolations | Lift the template, not the interpolated values: t('key', { name: user.name }). |
| Same string appears multiple times | Generate one key, reuse across call sites. |
--new-only and the existing locale file is corrupted | Halt — needs human inspection of the locale file before maintenance can proceed. |
| Test files in target | Skip — test strings aren't user-facing. |
| User asks for translation content | Refuse politely. /wbTranslate produces scaffolding; content is human or a separate model run. |
The pattern: /wbTranslate is i18n bootstrap, not i18n content. It identifies user-facing strings via a conservative heuristic, replaces them with key calls, populates the source-locale file, generates a translator-facing glossary. It refuses to invent translations, refuses to act on ambiguous targets, refuses scope shapes that don't produce reliable extraction. The output is a foundation that humans (or follow-on translation processes) can build on.
