Skip to content

@jsvision/i18n / mergeCatalogs

Function: mergeCatalogs() ​

mergeCatalogs(inputs): readonly Catalog[]

Defined in: catalog.ts:163

Merge ordered locale-scoped catalogs into one validated catalog per locale.

Locale order follows first appearance. For the same locale and key, a later input replaces the earlier message. Every returned catalog and message is an independent frozen copy.

Parameters ​

inputs ​

readonly unknown[]

Ordered schema-1 catalogs, lowest priority first.

Returns ​

readonly Catalog[]

Frozen catalogs grouped by locale in first-appearance order.

Throws ​

An I18nError when any input catalog is invalid.

Example ​

ts
mergeCatalogs([
  { schema: 1, locale: 'en', messages: { 'app.ok': 'OK' } },
  { schema: 1, locale: 'en', messages: { 'app.ok': 'Confirm' } },
]);