mwg API
    Preparing search index...

    Function catalogUsage

    • Which of a catalog's keys a game's own source actually references, and which just sit there. mwg has no idea how a game's code names a message key (a string literal, a generated constant, a SemanticMessage.type) - referencedKeys is however the caller already found that out (typically a grep or a build-time scan over its own source), the same boundary rollRoster draws around a game's own roster values.

      Parameters

      • catalog: Catalog
      • referencedKeys: Iterable<string>

      Returns CatalogUsageStats

      import { catalogUsage } from '@datamoc/mw_games/i18n';

      const catalog = {
      locale: 'en', direction: 'ltr' as const,
      messages: { greeting: 'Hi', unused: 'never shown' },
      };

      catalogUsage(catalog, ['greeting']); // { totalKeys: 2, usedKeys: 1, unusedKeys: ['unused'] }