const i18n = inject(WrI18n);
await i18n.registerScope('checkout');
i18n.t('address.zip', undefined, 'checkout');Scopes
Load a feature's catalog only when the feature loads.
Register a scope
Call once per feature, for example in a route guard.
Consume in templates
Pass the scope to the pipe or the directive.
{{ 'address.zip' | wrT: null : 'checkout' }}
<label [wrT]="'address.zip'" [wrTScope]="'checkout'"></label>Loader layout
Put {scope} in the HTTP path; rootPath is for the root catalog.
provideWrI18nHttpLoader({
path: '/assets/i18n/{scope}/{locale}.json', // /assets/i18n/checkout/en.json
rootPath: '/assets/i18n/{locale}.json', // /assets/i18n/en.json
});
// Static loader: scopes are the second argument.
provideWrI18nStaticLoader(rootCatalogs, { checkout: { en: { … }, ru: { … } } });