mwg API
    Preparing search index...

    Function validateCatalog

    • Structural problems inside one catalog, independent of any other: an empty string, or a plural form with no other branch - Intl.PluralRules guarantees other is always a valid category for every locale, so a form set lacking it will silently degrade for any count the more specific branches don't cover (t()'s own resolvePlural falls back to any form present, which hides exactly this mistake instead of surfacing it).

      This is deliberately not a parameter schema validator: SemanticMessage<TType, TParams> already gives a game compile-time checking of which params a message needs, which the source document calls the primary mechanism - a runtime schema on top would duplicate that for no case a game's own types do not already catch.

      Parameters

      Returns CatalogIssue[]

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

      const catalog = {
      locale: 'en', direction: 'ltr' as const,
      messages: { empty: '', broken: { few: 'a few' } },
      };

      console.log(validateCatalog(catalog).map((issue) => issue.key)); // ['empty', 'broken']