mwg API
    Preparing search index...

    Function extractDialogueCatalog

    • Collects every say/ask line's text into an identity catalog - each key mapping to itself, the same shape MWL's own extractCatalog builds from _("...")-marked strings - so a translator has real entries to work from instead of a wall of untranslated dialogue. Accepts either a flat command list (parseDialogueText's own output) or a StoryScript graph (importTwee's), so the same extraction step covers both dialogue paths.

      Parameters

      Returns Catalog

      import { parseDialogueText, extractDialogueCatalog } from '@datamoc/mwg/two-d';

      const commands = parseDialogueText('@alice Hello.\n');
      console.log(extractDialogueCatalog(commands).messages); // { 'Hello.': 'Hello.' }