mwg API
    Preparing search index...

    Function diffCatalogKeys

    • Compares two catalogs' key sets - typically a base language against a translation, so a missing or stray key is caught before a player sees a raw key fall through t()'s own fallback, rather than after.

      Parameters

      Returns CatalogKeyDiff

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

      const en = { locale: 'en', direction: 'ltr' as const, messages: { greeting: 'Hello', farewell: 'Bye' } };
      const fr = { locale: 'fr', direction: 'ltr' as const, messages: { greeting: 'Bonjour', extra: 'oops' } };

      console.log(diffCatalogKeys(en, fr)); // { missing: ['farewell'], extra: ['extra'] }