mwg API
    Preparing search index...

    Function extractCatalog

    • Extract a translation catalog compatible with mwg/i18n from a compiled game. MWL keeps the source text as the message id, so the base-language catalog maps each id to itself and translators fill in the other locales.

      Parameters

      Returns MwlCatalog

      import { compile, extractCatalog } from '@datamoc/mw_games/mwl';

      const game = compile("[{ tag: 'game', schema: 0.1 }]");
      console.log(extractCatalog(game, { locale: 'fr' }).locale); // 'fr'