Service

Scopes

Feature-scoped catalogs let large apps ship the root vocabulary upfront and lazy-load the rest. The scope name is the path key — same on every loader, every locale.

Register a scope

Call once per feature, typically from a route resolver or the feature's bootstrap. The scope's catalog auto-reloads on every locale change.

// In a feature module / route resolver:
const i18n = inject(WrI18n);
await i18n.registerScope('checkout');

// Static loader: catalog must exist under that key
// HTTP loader: fetched from path interpolated with both {locale} and {scope}

Consume in templates

The pipe and directive both accept a scope; the service takes it as a third arg.

<!-- pipe -->
{{ 'address.zip' | wrT: undefined: 'checkout' }}

<!-- directive -->
<label [wrT]="'address.zip'" [wrTScope]="'checkout'"></label>

<!-- service -->
i18n.t('address.zip', undefined, 'checkout');

HTTP layout

The HTTP loader interpolates {scope} and {locale} into its path template. rootPath is optional — defaults to path with an empty {scope}.

// HTTP loader will request:
//   GET /assets/i18n/checkout/en.json
//   GET /assets/i18n/checkout/ru.json
provideWrI18nHttpLoader({
  path: '/assets/i18n/{scope}/{locale}.json',
  rootPath: '/assets/i18n/{locale}.json',
});