v0.4.0GitHub—

docs / guides / localization

Names and localization

Customize task captions, section names, bubbles, and completion text.

##Choose a language

English and French are built in. Swarm Troopers resolves the locale from chat.locale when provided, then the top-level locale, then the document’s lang, and finally English. It lowercases and uses the first two characters, so fr-CA selects French. Unsupported languages fall back to English.

javascript
create({
  root: 'main', auto: true,
  locale: 'en',
  names: ['Ada', 'Mia', 'Iris'],
  leadName: 'Swarm Troopers',
  chat: false,
});

Names, task captions, and completion text work without bubbles. names: false hides pointer name tags and their attached task captions; it does not change your page content. Worker names come from a supplied pool, not automatic translation. leadName overrides the localized orchestrator name.

##ChatOptions reference

FieldMeaning
localeLocale override for the text pack.
linesPartial map of speech keys to arrays of strings. Keys: plan, ready, reply, rush, done.
subjectsPartial words for header, footer, and fallback part.
tasksPartial verb templates for type, frame, rule, stamp, and fallback other.
kindsPartial words for title, text, label, item, button, link, image, card, line, list, and block.
bubblesDefaults to true for an options object; false keeps overrides while suppressing speech.
summaryTemplate for the line below the completion title.

##Text templates

Speech templates use {s} for the section name and {n} for worker count. Task templates use {k} for the element kind. The summary uses {t} for tasks, {a} for spawned agents, and {d} for rounded elapsed seconds. Use each placeholder once per template; replacement is simple rather than a general templating engine.

javascript
create({
  root: 'main', auto: true,
  chat: {
    bubbles: false,
    lines: { done: ['All set.'] },
    tasks: { type: 'Writing {k}', frame: 'Placing {k}' },
    kinds: { title: 'the headline' },
    summary: '{t} details · {a} teammates · {d} s',
  },
});

The first done line also supplies the finale’s title, even when bubbles are off. Other arrays are choices for speech. An empty speech array suppresses that key. Custom section labels and actual page headings remain exactly the text you authored.

##Keep it readable

Orchestrator bubbles are off by default. Enable them with chat: true or an options object when they help explain a demonstration. Keep captions short: long labels are fitted to the viewport, and narrow screens limit concurrent captions to avoid a cluster of text.