@mmstack/translate 21.1.8 β†’ 21.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,23 +30,25 @@ It uses the robust **FormatJS** Intl runtime (`@formatjs/intl`) for ICU message
30
30
  - 🌍 **ICU Message Syntax:** Uses FormatJS runtime for robust support of variables (`{name}`), `plural`, `select`, and `selectordinal`. (Note: Complex inline date/number formats are not the focus; use Angular's built-in Pipes/format functions & use the result as variables in your translation.)
31
31
  - πŸ”— **Shared Namespace Support:** Define common translations (e.g., 'Save', 'Cancel') in one namespace and make them type-safely accessible from others.
32
32
  - πŸ› οΈ **Template Helpers:** Includes abstract `Translator` pipe and `Translate` directive for easy, type-safe templating.
33
+ - πŸ”’ **Reactive Formatters:** First-class, Intl-based, locale-aware formatters for dates, numbers, currencies, percentages, lists, and relative time β€” all automatically reactive to locale changes via signals, no zone or common/locale dependency required.
33
34
 
34
35
  ### Comparison
35
36
 
36
- While Angular offers excellent i18n solutions like `@angular/localize` and `transloco`, `@mmstack/translate` aims to fill a specific niche by supporting **both** traditional multi-build and modern single-build approaches.
37
-
38
- | Feature | `@mmstack/translate` | `@angular/localize` | `transloco` | `ngx-translate` |
39
- | :----------------------- | :----------------------------------: | :----------------------: | :---------------------------: | :------------------------: |
40
- | **Build Process** | βœ… Single or Multi-Build | ❌ Multi-Build (Typical) | βœ… Single Build | βœ… Single Build |
41
- | **Translation Timing** | Runtime or Build Time | Compile Time | Runtime | Runtime |
42
- | **Type Safety (Keys)** | βœ… Strong (Inferred from structure) | 🟑 via extraction | 🟑 Tooling/TS Files | 🟑 OK Manual/Tooling |
43
- | **Type Safety (Params)** | βœ… Strong (Inferred from ICU) | ❌ None | 🟑 Manual | 🟑 Manual |
44
- | **Locale Switching** | βœ… Dynamic (Runtime) or Page refresh | πŸ”„ Page Refresh Required | βœ… Dynamic (Runtime) | βœ… Dynamic (Runtime) |
45
- | **Lazy Loading** | βœ… Built-in (Namespaces/Resolvers) | N/A (Compile Time) | βœ… Built-in (Scopes) | βœ… Yes (Custom Loaders) |
46
- | **Namespacing/Scopes** | βœ… Built-in | ❌ None | βœ… Built-in (Scopes) | 🟑 Manual (File Structure) |
47
- | **ICU Support** | βœ… Subset (via FormatJS Runtime) | βœ… Yes (Compile Time) | βœ… Yes (Runtime Intl/Plugins) | 🟑 Via Extensions |
48
- | **Signal Integration** | βœ… Good (`t.asSignal()`) | N/A | βœ… Good (`translateSignal()`) | ❌ Minimal/None |
49
- | **Maturity / Community** | ✨ New | Core Angular | βœ… Mature / Active | βœ… Mature |
37
+ While Angular offers excellent i18n solutions like `@angular/localize` and `@jsverse/transloco`, `@mmstack/translate` aims to fill a specific niche by supporting **both** traditional multi-build and modern single-build approaches with a typesafe & modular approach, perfect for nx-based environments.
38
+
39
+ | Feature | `@mmstack/translate` | `@angular/localize` | `@jsverse/transloco` | `ngx-translate` |
40
+ | :----------------------- | :----------------------------------: | :---------------------------: | :--------------------------------------------------------------------------------------------------: | :-------------------------: |
41
+ | **Build Process** | βœ… Single or Multi-Build | ❌ Multi-Build (Typical) | βœ… Single Build | βœ… Single Build |
42
+ | **Translation Timing** | Runtime or Build Time | Compile Time | Runtime | Runtime |
43
+ | **Type Safety (Keys)** | βœ… Strong (Inferred from structure) | 🟑 via extraction | 🟑 Tooling/TS Files | 🟑 OK Manual/Tooling |
44
+ | **Type Safety (Params)** | βœ… Strong (Inferred from ICU) | ❌ None | 🟑 Manual | 🟑 Manual |
45
+ | **Locale Switching** | βœ… Dynamic (Runtime) or Page refresh | πŸ”„ Page Refresh Required | βœ… Dynamic (Runtime) | βœ… Dynamic (Runtime) |
46
+ | **Lazy Loading** | βœ… Built-in (Namespaces/Resolvers) | N/A (Compile Time) | βœ… Built-in (Scopes) | βœ… Yes (Custom Loaders) |
47
+ | **Namespacing/Scopes** | βœ… Built-in | ❌ None | βœ… Built-in (Scopes) | 🟑 Manual (File Structure) |
48
+ | **ICU Support** | βœ… Subset (via FormatJS Runtime) | βœ… Yes (Compile Time) | βœ… Yes (Runtime Intl/Plugins) | 🟑 Via Extensions |
49
+ | **Signal Integration** | βœ… Great (fully reactive) | N/A | βœ… Good (`translateSignal()`, `activeLang` signal) | ❌ Minimal/NoneΒΉ |
50
+ | **Reactive Formatters** | βœ… Built-in Intl integration | 🟑 Angular pipes (zone-based) | βœ… @jsverse/transloco-locale(`transloco-locale`Β²: date/number/currency/percent, not signal-reactive) | ❌ None (use Angular pipes) |
51
+ | **Maturity / Community** | 🟑 Less mature, but battle tested | Core Angular | βœ… Mature / Active | βœ… Mature |
50
52
 
51
53
  ## Installation
52
54
 
@@ -215,13 +217,11 @@ import { type QuoteLocale } from './quote.namespace';
215
217
 
216
218
  @Pipe({
217
219
  name: 'translate',
218
- standalone: true,
219
220
  })
220
221
  export class QuoteTranslator extends Translator<QuoteLocale> {}
221
222
 
222
223
  @Directive({
223
224
  selector: '[translate]', // Input in Translate is named 'translate'
224
- standalone: true,
225
225
  })
226
226
  export class QuoteTranslate<TInput extends string> extends Translate<TInput, QuoteLocale> {}
227
227
  ```
@@ -235,12 +235,18 @@ import { QuoteTranslator, QuoteTranslate } from './quote.helpers';
235
235
 
236
236
  @Component({
237
237
  selector: 'app-quote',
238
- standalone: true,
239
238
  imports: [QuoteTranslator, QuoteTranslate],
240
239
  template: `
240
+ <!-- t() can be called directly in templates for variable-free keys.
241
+ It is fully reactive & performant enough for this to work well -->
242
+ <h1>{{ t('quote.pageTitle') }}</h1>
243
+ <span>{{ t('quote.detail.authorLabel') }}</span>
244
+
245
+ <!-- For keys with variables, use t.asSignal() instead (see below).
246
+ Calling t('key', { ... }) in a template creates a new object literal
247
+ every change detection cycle, causing recomputation & gc churn -->
248
+
241
249
  <!-- Pipe validates key & variables match -->
242
- <h1>{{ 'quote.pageTitle' | translate }}</h1>
243
- <!-- Non-pluralized params must be string -->
244
250
  <span>{{ 'quote.errors.minLength' | translate: { min: '5' } }}</span>
245
251
 
246
252
  <!-- Directive replaces textContent of element -->
@@ -250,18 +256,35 @@ import { QuoteTranslator, QuoteTranslate } from './quote.helpers';
250
256
  })
251
257
  export class QuoteComponent {
252
258
  protected readonly count = signal(0);
253
- private readonly t = injectQuoteT();
254
259
 
255
- // Static translation
256
- private readonly author = this.t('quote.detail.authorLabel');
260
+ // Must be protected/public to be accessible from the template
261
+ protected readonly t = injectQuoteT();
257
262
 
258
- // Reactive translation with signal parameters
259
- private readonly stats = this.t.asSignal('quote.stats', () => ({
263
+ // performance best case, but only useful in a compiled locale scenario (when using LOCALE_ID)
264
+ protected readonly title = t('quote.pageTitle');
265
+
266
+ // For variable keys (or optimization scenarios), use asSignal() β€” it memoizes the result and only
267
+ // re-evaluates when the signal-based parameters actually change. If no variables are provided it basically
268
+ // recomputes only on locale changes
269
+ protected readonly stats = this.t.asSignal('quote.stats', () => ({
260
270
  count: this.count(), // Must match ICU parameter (type: number)
261
271
  }));
262
272
  }
263
273
  ```
264
274
 
275
+ **When to use each API:**
276
+
277
+ | Scenario | Recommended API |
278
+ | :----------------------------------------- | :----------------------------------------------------------- |
279
+ | Variable-free key in a template | `{{ t('ns.key') }}` |
280
+ | Variable-free key in class logic | `this.t('ns.key')` |
281
+ | Key with variables in a template | `t.asSignal('ns.key', () => ({ var: val() }))` |
282
+ | Key with variables in class logic | `this.t.asSignal('ns.key', () => ({ var: val() }))` |
283
+ | Type-safe pipe (with or without variables) | `'ns.key' \| translate` / `'ns.key' \| translate: vars` |
284
+ | Structural DOM replacement | `<el translate="ns.key">` / `[translate]="['ns.key', vars]"` |
285
+
286
+ > **Why not `t(key, vars)` in templates?** Each change detection cycle creates a new object literal for `vars`, so FormatJS re-formats the message even when the values haven't changed. `t.asSignal()` wraps the params in a `computed()` with deep equality, skipping re-evaluation when the underlying values are stable.
287
+
265
288
  ### 4. [OPTIONAL] Route-Based Locale Detection
266
289
 
267
290
  For applications with locale-based routing (e.g., `/en-US/quotes`, `/sl-SI/quotes`), the library can automatically detect and switch locales.
@@ -544,6 +567,12 @@ The library includes a set of reactive formatters that automatically adapt to th
544
567
 
545
568
  **Note:** For reactivity, wrap them in a `computed()` if the input signals change or if you want them to react to dynamic locale changes.
546
569
 
570
+ **SSR note:** Formatters read the active locale from a process-level signal. This is safe for all client-side usage and for SSR on serverless platforms (Lambda, Vercel, Netlify Edge) or worker-thread pools, where each request runs in an isolated V8 context. If you run a traditional single-process Node.js SSR server and concurrently render pages for **different** locales, pass the locale explicitly via the `locale` option on each formatter to avoid a potential cross-request read:
571
+
572
+ ```typescript
573
+ readonly displayDate = computed(() => formatDate(this.date, { locale: this.currentLocale() }));
574
+ ```
575
+
547
576
  Available formatters:
548
577
 
549
578
  - **`formatDate`**: Wraps `Intl.DateTimeFormat`
@@ -131,29 +131,29 @@ function injectSupportedLocales() {
131
131
  * @internal
132
132
  * the actual locale signal used to store the current locale string
133
133
  */
134
- const STORE_LOCALE = signal('en-US', ...(ngDevMode ? [{ debugName: "STORE_LOCALE" }] : []));
134
+ const STORE_LOCALE = signal('en-US', ...(ngDevMode ? [{ debugName: "STORE_LOCALE" }] : /* istanbul ignore next */ []));
135
135
  function injectLocaleInternal() {
136
136
  return STORE_LOCALE;
137
137
  }
138
138
  class TranslationStore {
139
139
  cache = createIntlCache();
140
140
  config = injectIntlConfig();
141
- loadQueue = signal([], ...(ngDevMode ? [{ debugName: "loadQueue" }] : []));
141
+ loadQueue = signal([], ...(ngDevMode ? [{ debugName: "loadQueue" }] : /* istanbul ignore next */ []));
142
142
  locale;
143
143
  defaultLocale = injectDefaultLocale();
144
144
  translations = signal({
145
145
  [this.defaultLocale]: {},
146
- }, ...(ngDevMode ? [{ debugName: "translations" }] : []));
146
+ }, ...(ngDevMode ? [{ debugName: "translations" }] : /* istanbul ignore next */ []));
147
147
  attemptedFallbackLoad = false;
148
148
  onDemandLoaders = new Map();
149
149
  nonMessageConfig = computed(() => ({
150
150
  ...this.config,
151
151
  locale: this.locale(),
152
- }), ...(ngDevMode ? [{ debugName: "nonMessageConfig" }] : []));
152
+ }), ...(ngDevMode ? [{ debugName: "nonMessageConfig" }] : /* istanbul ignore next */ []));
153
153
  messages = computed(() => this.translations()[this.locale()] ??
154
154
  this.translations()[this.defaultLocale] ??
155
- {}, ...(ngDevMode ? [{ debugName: "messages" }] : []));
156
- dynamicLocaleLoader = resource({ ...(ngDevMode ? { debugName: "dynamicLocaleLoader" } : {}), params: computed(() => this.loadQueue().at(0) ?? null),
155
+ {}, ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
156
+ dynamicLocaleLoader = resource({ ...(ngDevMode ? { debugName: "dynamicLocaleLoader" } : /* istanbul ignore next */ {}), params: computed(() => this.loadQueue().at(0) ?? null),
157
157
  loader: async ({ params: newLocale, abortSignal }) => {
158
158
  if (!newLocale)
159
159
  return;
@@ -193,7 +193,7 @@ class TranslationStore {
193
193
  intl = computed(() => createIntl({
194
194
  ...this.nonMessageConfig(),
195
195
  messages: this.messages(),
196
- }, this.cache), ...(ngDevMode ? [{ debugName: "intl" }] : []));
196
+ }, this.cache), ...(ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []));
197
197
  constructor() {
198
198
  this.locale = STORE_LOCALE;
199
199
  this.locale.set(injectDefaultLocale());
@@ -273,10 +273,10 @@ class TranslationStore {
273
273
  hasLocaleLoaders(locale) {
274
274
  return Array.from(this.onDemandLoaders.values()).some((loaders) => loaders[locale]);
275
275
  }
276
- static Ι΅fac = i0.Ι΅Ι΅ngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslationStore, deps: [], target: i0.Ι΅Ι΅FactoryTarget.Injectable });
277
- static Ι΅prov = i0.Ι΅Ι΅ngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslationStore, providedIn: 'root' });
276
+ static Ι΅fac = i0.Ι΅Ι΅ngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TranslationStore, deps: [], target: i0.Ι΅Ι΅FactoryTarget.Injectable });
277
+ static Ι΅prov = i0.Ι΅Ι΅ngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TranslationStore, providedIn: 'root' });
278
278
  }
279
- i0.Ι΅Ι΅ngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: TranslationStore, decorators: [{
279
+ i0.Ι΅Ι΅ngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TranslationStore, decorators: [{
280
280
  type: Injectable,
281
281
  args: [{
282
282
  providedIn: 'root',
@@ -595,12 +595,15 @@ function createEqualsRecord(keys = []) {
595
595
  return keyMatcher(a, b);
596
596
  };
597
597
  }
598
- function addSignalFn(fn, store) {
598
+ function addSignalFn(fn, store, keyMap) {
599
599
  const withSig = fn;
600
- const asSignal = (key, ...args) => {
601
- const variables = args[0];
600
+ const asSignal = (key, variables) => {
602
601
  const stringKey = key;
603
- const flatPath = replaceWithDelim(stringKey);
602
+ let flatPath = keyMap.get(stringKey);
603
+ if (flatPath === undefined) {
604
+ flatPath = replaceWithDelim(stringKey);
605
+ keyMap.set(stringKey, flatPath);
606
+ }
604
607
  const varsFn = variables ?? (() => undefined);
605
608
  const varsSignal = isSignal(varsFn)
606
609
  ? varsFn
@@ -612,17 +615,23 @@ function addSignalFn(fn, store) {
612
615
  withSig.asSignal = asSignal;
613
616
  return withSig;
614
617
  }
615
- function createT(store) {
616
- return (key, ...args) => {
617
- const variables = args[0];
618
+ function createT(store, keyMap = new Map()) {
619
+ const fn = (key, variables) => {
618
620
  const stringKey = key;
619
- return store.formatMessage(replaceWithDelim(stringKey), variables);
621
+ let k = keyMap.get(stringKey);
622
+ if (k === undefined) {
623
+ k = replaceWithDelim(stringKey);
624
+ keyMap.set(stringKey, k);
625
+ }
626
+ return store.formatMessage(k, variables);
620
627
  };
628
+ return fn;
621
629
  }
622
630
  function registerNamespace(defaultTranslation, other) {
631
+ const keyMap = new Map();
623
632
  const injectT = () => {
624
633
  const store = inject(TranslationStore);
625
- return addSignalFn(createT(store), store);
634
+ return addSignalFn(createT(store, keyMap), store, keyMap);
626
635
  };
627
636
  let defaultTranslationLoaded = false;
628
637
  const resolver = async (snapshot) => {
@@ -686,9 +695,10 @@ function registerNamespace(defaultTranslation, other) {
686
695
  * The resolver & t function work the same as they would with typed namespaces, but without type safety
687
696
  */
688
697
  function registerRemoteNamespace(ns, defaultTranslation, other) {
698
+ const keyMap = new Map();
689
699
  const injectT = () => {
690
700
  const store = inject(TranslationStore);
691
- return addSignalFn(createT(store), store);
701
+ return addSignalFn(createT(store, keyMap), store, keyMap);
692
702
  };
693
703
  let defaultTranslationLoaded = false;
694
704
  const resolver = async (snapshot) => {
@@ -778,30 +788,36 @@ function canMatchLocale(prefixSegments = []) {
778
788
  };
779
789
  }
780
790
 
791
+ function compareObjects(a, b) {
792
+ if (!a && !b)
793
+ return true;
794
+ if (!a || !b)
795
+ return false;
796
+ const aKeys = Object.keys(a);
797
+ const bKeys = Object.keys(b);
798
+ if (aKeys.length !== bKeys.length)
799
+ return false;
800
+ return aKeys.every((key) => a[key] === b[key]);
801
+ }
781
802
  class Translate {
782
803
  t = createT(inject(TranslationStore));
783
- translate = input.required(...(ngDevMode ? [{ debugName: "translate" }] : []));
804
+ translate = input.required(...(ngDevMode ? [{ debugName: "translate" }] : /* istanbul ignore next */ []));
784
805
  constructor() {
785
- const key = computed(() => {
786
- const vars = this.translate();
787
- return (Array.isArray(vars) ? vars[0] : vars);
788
- }, ...(ngDevMode ? [{ debugName: "key" }] : []));
789
- const args = computed(() => {
790
- const vars = this.translate();
791
- return (Array.isArray(vars) ? vars[1] : undefined);
792
- }, { ...(ngDevMode ? { debugName: "args" } : {}), equal: (a, b) => {
793
- if (a === undefined && b === undefined)
806
+ const inputs = computed(() => this.translate(), { ...(ngDevMode ? { debugName: "inputs" } : /* istanbul ignore next */ {}), equal: (a, b) => {
807
+ if (a === b)
794
808
  return true;
795
- if (a === undefined || b === undefined)
809
+ if (typeof a === 'string' || typeof b === 'string')
810
+ return false;
811
+ if (a[0] !== b[0])
796
812
  return false;
797
- const aObj = a;
798
- const keys = Object.keys(aObj);
799
- const bObj = b;
800
- if (!keys.length)
801
- return !Object.keys(bObj).length;
802
- return keys.every((key) => aObj[key] === bObj[key]);
813
+ return compareObjects(a[1], b[1]);
803
814
  } });
804
- const translation = computed(() => this.t(key(), args()), ...(ngDevMode ? [{ debugName: "translation" }] : []));
815
+ const translation = computed(() => {
816
+ const inp = inputs();
817
+ return typeof inp === 'string'
818
+ ? this.t(inp)
819
+ : this.t(inp[0], inp[1]);
820
+ }, ...(ngDevMode ? [{ debugName: "translation" }] : /* istanbul ignore next */ []));
805
821
  const renderer = inject(Renderer2);
806
822
  const el = inject(ElementRef);
807
823
  afterRenderEffect({
@@ -810,27 +826,34 @@ class Translate {
810
826
  },
811
827
  });
812
828
  }
813
- static Ι΅fac = i0.Ι΅Ι΅ngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: Translate, deps: [], target: i0.Ι΅Ι΅FactoryTarget.Directive });
814
- static Ι΅dir = i0.Ι΅Ι΅ngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: Translate, isStandalone: true, inputs: { translate: { classPropertyName: "translate", publicName: "translate", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
829
+ static Ι΅fac = i0.Ι΅Ι΅ngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Translate, deps: [], target: i0.Ι΅Ι΅FactoryTarget.Directive });
830
+ static Ι΅dir = i0.Ι΅Ι΅ngDeclareDirective({ minVersion: "17.1.0", version: "21.2.8", type: Translate, isStandalone: true, inputs: { translate: { classPropertyName: "translate", publicName: "translate", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
815
831
  }
816
- i0.Ι΅Ι΅ngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: Translate, decorators: [{
832
+ i0.Ι΅Ι΅ngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Translate, decorators: [{
817
833
  type: Directive
818
834
  }], ctorParameters: () => [], propDecorators: { translate: [{ type: i0.Input, args: [{ isSignal: true, alias: "translate", required: true }] }] } });
819
835
 
836
+ function createTransformFn() {
837
+ const store = inject(TranslationStore);
838
+ const t = createT(store);
839
+ const fn = (key, variablesOrLocale,
840
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
841
+ _) => {
842
+ const vars = typeof variablesOrLocale === 'string' ? undefined : variablesOrLocale;
843
+ return t(key, vars);
844
+ };
845
+ return fn;
846
+ }
820
847
  class Translator {
821
- store = inject(TranslationStore);
822
- t = createT(this.store);
823
848
  constructor() {
824
849
  const cdr = inject(ChangeDetectorRef);
850
+ const locale = inject(TranslationStore).locale;
825
851
  effect(() => {
826
- this.store.locale();
852
+ locale();
827
853
  cdr.markForCheck();
828
854
  });
829
855
  }
830
- transform(key, ...args) {
831
- const actualArgs = args.filter((a) => typeof a === 'object');
832
- return this.t(key, ...actualArgs);
833
- }
856
+ transform = createTransformFn();
834
857
  }
835
858
 
836
859
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mmstack-translate.mjs","sources":["../../../../packages/translate/src/lib/delim.ts","../../../../packages/translate/src/lib/compile.ts","../../../../packages/translate/src/lib/create-namespace.ts","../../../../packages/translate/src/lib/path-param.ts","../../../../packages/translate/src/lib/translation-store.ts","../../../../packages/translate/src/lib/format/unwrap.ts","../../../../packages/translate/src/lib/format/date.ts","../../../../packages/translate/src/lib/format/display-name.ts","../../../../packages/translate/src/lib/format/list.ts","../../../../packages/translate/src/lib/format/numeric.ts","../../../../packages/translate/src/lib/format/relative-time.ts","../../../../packages/translate/src/lib/resovler-locale.ts","../../../../packages/translate/src/lib/register-namespace.ts","../../../../packages/translate/src/lib/route-helpers.ts","../../../../packages/translate/src/lib/translate.ts","../../../../packages/translate/src/lib/translator.ts","../../../../packages/translate/src/lib/testing/provide-mock-translations.ts","../../../../packages/translate/src/mmstack-translate.ts"],"sourcesContent":["const KEY_DELIM = '::MMT_DELIM::';\n\nexport function prependDelim(prefix: string, key: string): string {\n return `${prefix}${KEY_DELIM}${key}`;\n}\n\nexport function replaceWithDelim(str: string, repl = '.'): string {\n return str.replaceAll(repl, KEY_DELIM);\n}\n","import { prependDelim } from './delim';\nimport type {\n inferTranslationParamMap,\n inferTranslationShape,\n} from './parameterize.type';\nimport type { UnknownStringKeyObject } from './string-key-object.type';\n\nconst INTERNAL_SYMBOL = Symbol.for('mmstack-translate-internal');\n\ntype InternalSymbol = typeof INTERNAL_SYMBOL;\n\nexport type CompiledTranslation<\n T extends UnknownStringKeyObject,\n TNS extends string,\n TLocale extends string = string,\n> = {\n flat: Record<string, string>;\n locale?: TLocale;\n namespace: TNS;\n [INTERNAL_SYMBOL]: {\n shape: inferTranslationShape<T>;\n map: inferTranslationParamMap<TNS, T>;\n };\n};\n\nexport type mergeTranslationMaps<\n TMain extends CompiledTranslation<UnknownStringKeyObject, string>,\n TOther extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = Omit<TMain, InternalSymbol> & {\n [INTERNAL_SYMBOL]: {\n shape: inferCompiledTranslationShape<TMain>;\n map: inferCompiledTranslationMap<TOther> &\n inferCompiledTranslationMap<TMain>;\n };\n};\n\nexport type inferCompiledTranslationNamespace<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T['namespace'];\n\nexport type inferCompiledTranslationShape<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T[InternalSymbol]['shape'];\n\nexport type inferCompiledTranslationMap<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T[InternalSymbol]['map'];\n\nfunction isTranslationObject(t: unknown): t is UnknownStringKeyObject {\n return typeof t === 'object' && t !== null;\n}\n\nfunction flattenTranslation<T extends UnknownStringKeyObject>(obj: T) {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n if (typeof value === 'string') {\n acc[key] = value;\n } else if (isTranslationObject(value)) {\n Object.entries(flattenTranslation(value)).forEach(\n ([nestedKey, nestedValue]) => {\n acc[prependDelim(key, nestedKey)] = nestedValue;\n },\n );\n }\n\n return acc;\n },\n {} as Record<string, string>,\n );\n}\n\nexport function compileTranslation<\n T extends UnknownStringKeyObject,\n TNS extends string,\n TLocale extends string = string,\n>(\n translation: T,\n ns: TNS,\n locale?: TLocale,\n): CompiledTranslation<T, TNS, TLocale> {\n type $Shape = inferTranslationShape<T>;\n type $Map = inferTranslationParamMap<TNS, T>;\n\n return {\n locale,\n flat: flattenTranslation(translation),\n namespace: ns,\n [INTERNAL_SYMBOL]: {\n shape: {} as $Shape,\n map: {} as $Map,\n },\n };\n}\n","import {\n type CompiledTranslation,\n compileTranslation,\n type inferCompiledTranslationShape,\n type mergeTranslationMaps,\n} from './compile';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\n\ntype TranslationNamespace<\n TNS extends string,\n T extends CompiledTranslation<UnknownStringKeyObject, TNS>,\n TShape extends UnknownStringKeyObject,\n> = {\n translation: T;\n createTranslation: <TLocale extends string>(\n locale: TLocale,\n translation: TShape,\n ) => CompiledTranslation<TShape, TNS, TLocale>;\n createMergedNamespace: <\n TOtherNS extends string,\n const TOther extends UnknownStringKeyObject,\n TOtherCompiled extends CompiledTranslation<TOther, TOtherNS>,\n >(\n ns: TOtherNS,\n translation: TOther,\n ) => TranslationNamespace<\n TOtherNS,\n mergeTranslationMaps<TOtherCompiled, T>,\n inferCompiledTranslationShape<TOtherCompiled>\n >;\n};\n\nexport function createNamespace<\n const T extends UnknownStringKeyObject,\n TNS extends string,\n>(ns: TNS, translation: T) {\n const compiled = compileTranslation<T, TNS>(translation, ns);\n\n type TCompiled = typeof compiled;\n type TShape = inferCompiledTranslationShape<typeof compiled>;\n\n const namespace: TranslationNamespace<TNS, TCompiled, TShape> = {\n translation: compiled,\n createTranslation: <TLocale extends string>(\n locale: TLocale,\n translation: TShape,\n ) => {\n return compileTranslation(translation, ns, locale);\n },\n createMergedNamespace: <\n TOther extends UnknownStringKeyObject,\n TOtherNS extends string,\n TOtherCompiled extends CompiledTranslation<TOther, TOtherNS> =\n CompiledTranslation<TOther, TOtherNS>,\n >(\n otherNs: TOtherNS,\n otherTranslation: TOther,\n ) => {\n return createNamespace(otherNs, otherTranslation) as TranslationNamespace<\n TOtherNS,\n mergeTranslationMaps<TOtherCompiled, TCompiled>,\n inferCompiledTranslationShape<TOtherCompiled>\n > as unknown as any;\n },\n };\n\n return namespace;\n}\n","import { computed, inject, type Signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, type ParamMap, Router } from '@angular/router';\n\nexport function pathParam(\n key: string | (() => string),\n route = inject(ActivatedRoute),\n): Signal<string | null> {\n const keySignal =\n typeof key === 'string' ? computed(() => key) : computed(key);\n\n const routerOptions = inject(Router)['options'];\n\n if (\n routerOptions &&\n typeof routerOptions === 'object' &&\n routerOptions.paramsInheritanceStrategy === 'always'\n ) {\n const params = toSignal(route.paramMap, {\n initialValue: route.snapshot.paramMap,\n });\n\n return computed(() => params().get(keySignal()));\n }\n\n const paramMapSignals: Signal<ParamMap>[] = [];\n let currentRoute: ActivatedRoute | null = route;\n\n const isStatic = typeof key === 'string';\n\n while (currentRoute) {\n const initial = currentRoute.snapshot.paramMap;\n paramMapSignals.push(\n toSignal(currentRoute.paramMap, {\n initialValue: initial,\n }),\n );\n\n // For static keys, stop once we find the param, will find first in computed for loop already so basically noop for for loop\n if (isStatic && initial.has(key as string)) break;\n\n currentRoute = currentRoute.parent;\n }\n\n return computed(() => {\n const paramKey = keySignal();\n\n for (const map of paramMapSignals) {\n const v = map().get(paramKey);\n if (v) return v;\n }\n\n return null;\n });\n}\n","import {\n computed,\n effect,\n inject,\n Injectable,\n InjectionToken,\n isDevMode,\n LOCALE_ID,\n type Provider,\n resource,\n type Signal,\n signal,\n untracked,\n type WritableSignal,\n} from '@angular/core';\nimport { createIntl, createIntlCache, type IntlConfig } from '@formatjs/intl';\nimport { type CompiledTranslation } from './compile';\nimport { prependDelim } from './delim';\nimport { pathParam } from './path-param';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\n\nconst CONFIG_TOKEN = new InjectionToken<\n Omit<IntlConfig, 'locale' | 'messages'> & {\n supportedLocales?: string[];\n preloadDefaultLocale?: boolean;\n localeParamName?: string;\n }\n>('mmstack-intl-config');\n\nexport function provideIntlConfig(\n config: Omit<IntlConfig, 'locale' | 'messages'> & {\n /** Checks next locale is in provided array before switching locales */\n supportedLocales?: string[];\n /** Preloads the default locale ensuring sync fallback, not necessary for most cases as it will lazily load automatically when needed */\n preloadDefaultLocale?: boolean;\n /** Auto-resolution when using a locale parameter via angular router */\n localeParamName?: string;\n },\n): Provider[] {\n const providers: Provider[] = [\n {\n useFactory: (localeId: string) => {\n const next = {\n ...config,\n };\n\n const defaultLocale =\n config.defaultLocale ?? config.supportedLocales?.at(0) ?? localeId;\n\n if (\n next.supportedLocales &&\n !next.supportedLocales.includes(defaultLocale)\n ) {\n next.supportedLocales = [...next.supportedLocales, defaultLocale];\n }\n\n return next;\n },\n deps: [LOCALE_ID],\n provide: CONFIG_TOKEN,\n },\n ];\n\n const defaultLocale = config.defaultLocale ?? config.supportedLocales?.at(0);\n\n if (!defaultLocale) return providers;\n\n providers.push({\n provide: LOCALE_ID,\n useValue: defaultLocale,\n });\n\n return providers;\n}\n\nexport function injectIntlConfig() {\n return inject(CONFIG_TOKEN, { optional: true }) ?? undefined;\n}\n\nexport function injectDefaultLocale() {\n return injectIntlConfig()?.defaultLocale ?? inject(LOCALE_ID) ?? 'en-US';\n}\n\nexport function injectSupportedLocales() {\n return injectIntlConfig()?.supportedLocales ?? [injectDefaultLocale()];\n}\n\n/**\n * @internal\n * the actual locale signal used to store the current locale string\n */\nconst STORE_LOCALE = signal('en-US');\n\nexport function injectLocaleInternal() {\n return STORE_LOCALE;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TranslationStore {\n private readonly cache = createIntlCache();\n private readonly config = injectIntlConfig();\n readonly loadQueue = signal<string[]>([]);\n readonly locale: WritableSignal<string>;\n private readonly defaultLocale = injectDefaultLocale();\n private readonly translations = signal<\n Record<string, Record<string, string>>\n >({\n [this.defaultLocale]: {},\n });\n private attemptedFallbackLoad = false;\n\n private readonly onDemandLoaders = new Map<\n string,\n Record<\n string,\n () => Promise<CompiledTranslation<UnknownStringKeyObject, string>>\n >\n >();\n\n private readonly nonMessageConfig = computed(() => ({\n ...this.config,\n locale: this.locale(),\n }));\n\n private readonly messages = computed(\n () =>\n this.translations()[this.locale()] ??\n this.translations()[this.defaultLocale] ??\n {},\n );\n\n readonly dynamicLocaleLoader = resource({\n params: computed(() => this.loadQueue().at(0) ?? null),\n loader: async ({ params: newLocale, abortSignal }) => {\n if (!newLocale) return;\n\n const currentTranslations = untracked(this.translations);\n\n const loadPromises: Promise<{\n namespace: string;\n flat: Record<string, string>;\n } | null>[] = [];\n\n for (const [namespace, loaders] of this.onDemandLoaders.entries()) {\n const loader = loaders[newLocale];\n if (loader) {\n const hasNamespaceForLocale =\n currentTranslations[newLocale] &&\n Object.keys(currentTranslations[newLocale]).some((key) =>\n key.startsWith(`${prependDelim(namespace, '').slice(0, -1)}`),\n );\n\n if (!hasNamespaceForLocale) {\n loadPromises.push(\n loader()\n .then((translation) => {\n if (abortSignal.aborted) return null;\n return {\n namespace: translation.namespace,\n flat: translation.flat,\n };\n })\n .catch((err) => {\n if (isDevMode()) {\n console.error(\n '[Translate] Failed to load',\n namespace,\n newLocale,\n err,\n );\n }\n\n return null;\n }),\n );\n }\n }\n }\n\n return Promise.all(loadPromises)\n .then((res) => res.filter((r) => r !== null))\n .then((res) => ({\n locales: res,\n locale: newLocale,\n }));\n },\n });\n\n readonly intl = computed(() =>\n createIntl(\n {\n ...this.nonMessageConfig(),\n messages: this.messages(),\n },\n this.cache,\n ),\n );\n\n constructor() {\n this.locale = STORE_LOCALE;\n this.locale.set(injectDefaultLocale());\n const paramName = this.config?.localeParamName;\n if (paramName) {\n const param = pathParam(paramName);\n\n effect(() => {\n const loc = param();\n if (\n !loc ||\n loc === untracked(this.locale) ||\n untracked(this.loadQueue).includes(loc)\n )\n return;\n if (this.hasLocaleLoaders(loc)) this.locale.set(loc);\n else this.loadQueue.update((q) => [...q, loc]);\n });\n }\n\n effect(() => {\n if (\n // should never be in error state, but best to check in case something throws\n this.dynamicLocaleLoader.error() ||\n this.dynamicLocaleLoader.isLoading()\n )\n return;\n const dynamicLocales = this.dynamicLocaleLoader.value();\n\n if (!dynamicLocales) return;\n\n // Register loaded translations\n for (const locale of dynamicLocales.locales) {\n this.register(locale.namespace, {\n [dynamicLocales.locale]: locale.flat,\n });\n }\n\n const hasTranslations =\n dynamicLocales.locales.length > 0 ||\n this.translations()[dynamicLocales.locale];\n\n if (hasTranslations) {\n this.loadQueue.update((q) =>\n q.filter((l) => l !== dynamicLocales.locale),\n );\n this.locale.set(dynamicLocales.locale);\n }\n });\n }\n\n formatMessage(key: string, values?: Record<string, string | number>) {\n const message =\n this.translations()[this.locale()]?.[key] ??\n this.translations()[this.defaultLocale]?.[key] ??\n '';\n\n if (!message) {\n if (this.attemptedFallbackLoad) return '';\n\n this.attemptedFallbackLoad = true;\n untracked(() => {\n if (!this.loadQueue().includes(this.defaultLocale))\n this.loadQueue.update((q) => [...q, this.defaultLocale]);\n });\n return '';\n }\n\n return this.intl().formatMessage(\n { id: key, defaultMessage: message },\n values,\n );\n }\n\n register(\n namespace: string,\n flat: Partial<Record<string, Record<string, string>>>,\n ) {\n this.translations.update((cur) => {\n return Object.entries(flat).reduce(\n (acc, [locale, translation]) => {\n const localeTranslation = acc[locale] ?? {};\n\n const withNS = Object.entries(translation ?? {}).reduce(\n (acc, [key, value]) => {\n acc[prependDelim(namespace, key)] = value;\n return acc;\n },\n {} as Record<string, string>,\n );\n\n acc[locale] = {\n ...localeTranslation,\n ...withNS,\n };\n\n return acc;\n },\n { ...cur },\n );\n });\n }\n\n registerOnDemandLoaders(\n namespace: string,\n loaders: Record<string, () => Promise<any>>,\n ) {\n this.onDemandLoaders.set(namespace, loaders);\n }\n\n hasLocaleLoaders(locale: string): boolean {\n return Array.from(this.onDemandLoaders.values()).some(\n (loaders) => loaders[locale],\n );\n }\n}\n\nexport function injectIntl() {\n return inject(TranslationStore).intl;\n}\n\n/**\n * Inject a dynamic locale signal that supports runtime language switching.\n *\n * @returns A writable signal with the current locale and loading state.\n * Only allows switching to locales that have registered loaders.\n *\n * @example\n * ```typescript\n * const locale = injectDynamicLocale();\n *\n * // Switch language (triggers automatic translation loading)\n * locale.set('sl-SI');\n *\n * // Check loading state\n * if (locale.isLoading()) {\n * // Show spinner\n * }\n * ```\n */\nexport function injectDynamicLocale(): WritableSignal<string> & {\n isLoading: Signal<boolean>;\n} {\n const store = inject(TranslationStore);\n const supportedLocales = injectIntlConfig()?.supportedLocales;\n\n const source = computed(() => store.locale()) as WritableSignal<string> & {\n isLoading: Signal<boolean>;\n };\n\n const inSupportedLocales =\n supportedLocales === undefined\n ? () => true\n : (locale: string) => supportedLocales.includes(locale);\n\n const set = (value: string) => {\n if (\n value === untracked(source) ||\n untracked(store.loadQueue).includes(value)\n )\n return;\n\n if (!inSupportedLocales(value)) {\n if (isDevMode())\n console.warn(\n `[Translate] Locale \"${value}\" is not in supportedLocales, switch prevented. Available options are:`,\n supportedLocales,\n );\n\n return;\n }\n\n if (isDevMode() && !store.hasLocaleLoaders(value))\n console.warn(\n `[Translate] No loaders registered for locale \"${value}\". Switching to this locale will have no effect.`,\n );\n\n store.loadQueue.update((q) => [...q, value]);\n };\n\n source.set = set;\n source.update = (updater: (value: string) => string) => {\n const next = updater(untracked(source));\n source.set(next);\n };\n source.asReadonly = () => source;\n\n source.isLoading = store.dynamicLocaleLoader.isLoading;\n\n return source;\n}\n","import { isSignal, type Signal } from '@angular/core';\n\nexport function unwrap<T>(value: T | Signal<T>): T {\n return isSignal(value) ? value() : value;\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst FORMAT_PRESETS: Record<string, Intl.DateTimeFormatOptions> = {\n short: { dateStyle: 'short', timeStyle: 'short' },\n medium: { dateStyle: 'medium', timeStyle: 'medium' },\n long: { dateStyle: 'long', timeStyle: 'long' },\n full: { dateStyle: 'full', timeStyle: 'full' },\n\n shortDate: { dateStyle: 'short' },\n mediumDate: { dateStyle: 'medium' },\n longDate: { dateStyle: 'long' },\n fullDate: { dateStyle: 'full' },\n\n shortTime: { timeStyle: 'short' },\n mediumTime: { timeStyle: 'medium' },\n longTime: { timeStyle: 'long' },\n fullTime: { timeStyle: 'full' },\n};\n\ntype DateFormat = keyof typeof FORMAT_PRESETS;\n\n/**\n * Supported date inputs\n */\nexport type SupportedDateInput = Date | string | number | null | undefined;\n\n/**\n * Options for formatting a date\n */\nexport type FormatDateOptions = {\n /**\n * Timezone to use for formatting\n */\n tz?: string;\n /**\n * Format to use for formatting\n * @default 'medium'\n */\n format?: DateFormat;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction validDateOrNull(\n date: Date | string | number | null | undefined,\n): Date | null {\n if (date == null) return null;\n\n const d = date instanceof Date ? date : new Date(date);\n return isNaN(d.getTime()) ? null : d;\n}\n\nconst cache = new Map<string, Intl.DateTimeFormat>();\n\nfunction getFormatter(\n locale: string,\n format: DateFormat,\n timeZone?: string,\n): Intl.DateTimeFormat {\n const cacheKey = `${locale}|${format}|${timeZone ?? ''}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(locale, {\n ...FORMAT_PRESETS[format],\n timeZone,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a date using the current or provided locale & timezone\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param date - Date to format\n * @param opt - Options for formatting\n * @returns Formatted date string\n */\nexport function formatDate(\n date: SupportedDateInput | Signal<SupportedDateInput>,\n opt?: FormatDateOptions | Signal<FormatDateOptions>,\n): string {\n const validDate = validDateOrNull(unwrap(date));\n if (validDate === null) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.format ?? 'medium',\n unwrappedOpt?.tz,\n ).format(validDate);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst cache = new Map<string, Intl.DisplayNames>();\n\n/**\n * Options for formatting a display name\n */\nexport type FormatDisplayNameOptions = {\n /**\n * The display style for the result set\n */\n style: Intl.RelativeTimeFormatStyle;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction getFormatter(\n locale: string,\n type: Intl.DisplayNamesType,\n style: Intl.RelativeTimeFormatStyle,\n): Intl.DisplayNames {\n const cacheKey = `${locale}|${type}|${style}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.DisplayNames(locale, {\n type,\n style,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\ntype SupportedCode = string | null | undefined;\n\n/**\n * Format a display name using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The code to format\n * @param type - The type of display name to format\n * @param opt - Options for formatting\n * @returns Formatted display name string\n */\nexport function formatDisplayName(\n value: SupportedCode | Signal<SupportedCode>,\n type: Intl.DisplayNamesType | Signal<Intl.DisplayNamesType>,\n opt?: FormatDisplayNameOptions | Signal<FormatDisplayNameOptions>,\n): string {\n const unwrapped = unwrap(value);\n if (!unwrapped?.trim()) return '';\n\n const unwrappedType = unwrap(type);\n const unwrappedOpt = unwrap(opt);\n\n const locale = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return (\n getFormatter(locale, unwrappedType, unwrappedOpt?.style ?? 'long').of(\n unwrapped,\n ) ?? ''\n );\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\ntype ListType = 'conjunction' | 'disjunction' | 'unit';\ntype ListStyle = 'long' | 'short' | 'narrow';\n\nexport type SupportedListInput = string[] | null | undefined;\n\nconst cache = new Map<string, Intl.ListFormat>();\n\n/**\n * Options for formatting a list\n */\nexport type FormatListOptions = {\n /**\n * The type of list to format\n */\n type?: ListType;\n /**\n * The style of list to format\n */\n style?: ListStyle;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nconst EMPTY_ARRAY: string[] = [];\n\nfunction unwrapList(\n value: SupportedListInput | Signal<SupportedListInput>,\n): string[] {\n const unwrapped = unwrap(value);\n return Array.isArray(unwrapped) ? unwrapped : EMPTY_ARRAY;\n}\n\nfunction getFormatter(\n locale: string,\n type: ListType,\n style: ListStyle,\n): Intl.ListFormat {\n const cacheKey = `${locale}|${type}|${style}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.ListFormat(locale, { type, style });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a list using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The list to format\n * @param opt - Options for formatting\n * @returns Formatted list string\n */\nexport function formatList(\n value: SupportedListInput | Signal<SupportedListInput>,\n opt?: FormatListOptions | Signal<FormatListOptions>,\n): string {\n const unwrapped = unwrapList(value);\n if (unwrapped.length === 0) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.type ?? 'conjunction',\n unwrappedOpt?.style ?? 'long',\n ).format(unwrapped);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\ntype NumberNotation = 'standard' | 'scientific' | 'engineering' | 'compact';\n\ntype SupportedNumberValue = number | null | undefined;\n\nconst cache = new Map<string, Intl.NumberFormat>();\n\nfunction unwrapValue(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n fallbackToZero = false,\n): number | null {\n const unwrapped = unwrap(value);\n\n if (unwrapped === null || unwrapped === undefined || isNaN(unwrapped))\n return fallbackToZero ? 0 : null;\n\n return unwrapped;\n}\n\n/**\n * Options for formatting a number\n */\nexport type FormatNumberOptions = {\n /**\n * The notation to use for formatting\n */\n notation?: NumberNotation;\n /**\n * Minimum number of fraction digits to use\n */\n minFractionDigits?: number;\n /**\n * Maximum number of fraction digits to use\n */\n maxFractionDigits?: number;\n /**\n * Whether to use grouping\n */\n useGrouping?: boolean;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\nfunction getFormatter(\n locale: string,\n minFractionDigits: number | undefined,\n maxFractionDigits: number | undefined,\n useGrouping?: boolean,\n notation?: NumberNotation,\n currency?: string,\n display?: CurrencyDisplay,\n style?: 'currency' | 'percent',\n): Intl.NumberFormat {\n const cacheKey = `${locale}|${notation ?? 'standard'}|${minFractionDigits}|${maxFractionDigits}|${useGrouping ?? true}|${currency ?? 'none'}|${display ?? 'none'}|${style ?? 'decimal'}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, {\n style,\n notation,\n minimumFractionDigits: minFractionDigits,\n maximumFractionDigits: maxFractionDigits,\n useGrouping,\n currency,\n currencyDisplay: display,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a number using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param number - Number to format\n * @param opt - Options for formatting\n * @returns Formatted number string\n */\nexport function formatNumber(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n opt?: FormatNumberOptions | Signal<FormatNumberOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedNumber === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.minFractionDigits,\n unwrappedOpt?.maxFractionDigits,\n unwrappedOpt?.useGrouping ?? true,\n unwrappedOpt?.notation ?? 'standard',\n ).format(unwrappedNumber);\n}\n\n/**\n * Options for formatting a percentage value\n */\nexport type FormatPercentOptions = {\n /**\n * Minimum number of fraction digits to use\n */\n minFractionDigits?: number;\n /**\n * Maximum number of fraction digits to use\n */\n maxFractionDigits?: number;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\n/**\n * Format a percentage using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param number - Number to format\n * @param opt - Options for formatting\n * @returns Formatted percentage string\n */\nexport function formatPercent(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n opt?: FormatPercentOptions | Signal<FormatPercentOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n\n const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedNumber === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.minFractionDigits,\n unwrappedOpt?.maxFractionDigits,\n undefined,\n undefined,\n undefined,\n undefined,\n 'percent',\n ).format(unwrappedNumber);\n}\n\ntype CurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name';\n\n/**\n * Options for formatting a currency\n */\nexport type FormatCurrencyOptions = {\n /*\n * The display type for the currency format\n */\n display?: CurrencyDisplay;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\nexport function formatCurrency(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n currency: string | Signal<string>,\n opt?: FormatCurrencyOptions | Signal<FormatCurrencyOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n const unwrappedValue = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedValue === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n undefined,\n undefined,\n undefined,\n undefined,\n unwrap(currency),\n unwrappedOpt?.display ?? 'symbol',\n 'currency',\n ).format(unwrappedValue);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst cache = new Map<string, Intl.RelativeTimeFormat>();\n\n/**\n * Options for formatting a relative time value\n */\nexport type FormatRelativeTimeOptions = {\n /**\n * The length of the internationalized message.\n * @default 'long'\n */\n style?: Intl.RelativeTimeFormatStyle;\n /**\n * Controls whether to use numeric values in the output.\n * @default 'always'\n */\n numeric?: Intl.RelativeTimeFormatNumeric;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction getFormatter(\n locale: string,\n style: Intl.RelativeTimeFormatStyle,\n numeric: Intl.RelativeTimeFormatNumeric,\n): Intl.RelativeTimeFormat {\n const cacheKey = `${locale}|${style}|${numeric}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.RelativeTimeFormat(locale, { style, numeric });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\nexport type RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\ntype SupportedRelativeTimeInput = number | null | undefined;\n\n/**\n * Format a relative time using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The numeric value to use in the relative time internationalization message\n * @param unit - The unit to use in the relative time internationalization message\n * @param opt - Options for formatting\n * @returns Formatted relative time string\n */\nexport function formatRelativeTime(\n value: SupportedRelativeTimeInput | Signal<SupportedRelativeTimeInput>,\n unit: RelativeTimeUnit | Signal<RelativeTimeUnit>,\n opt?: FormatRelativeTimeOptions | Signal<FormatRelativeTimeOptions>,\n): string {\n const unwrappedValue = unwrap(value);\n if (\n unwrappedValue === null ||\n unwrappedValue === undefined ||\n isNaN(unwrappedValue)\n )\n return '';\n\n const unwrappedUnit = unwrap(unit);\n if (!unwrappedUnit) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.style ?? 'long',\n unwrappedOpt?.numeric ?? 'always',\n ).format(unwrappedValue, unwrappedUnit);\n}\n","import { inject, untracked } from '@angular/core';\nimport { type ActivatedRouteSnapshot, Router } from '@angular/router';\nimport { injectIntlConfig, TranslationStore } from './translation-store';\n\nexport function injectResolveParamLocale(snapshot: ActivatedRouteSnapshot) {\n let locale: string | null = null;\n\n const paramName = injectIntlConfig()?.localeParamName;\n\n const routerConfig = inject(Router)['options'];\n\n const alwaysInheritParams =\n typeof routerConfig === 'object' &&\n !!routerConfig &&\n routerConfig.paramsInheritanceStrategy === 'always';\n\n if (paramName) {\n locale = snapshot.paramMap.get(paramName);\n\n if (!locale && !alwaysInheritParams) {\n let currentRoute: ActivatedRouteSnapshot | null = snapshot;\n while (currentRoute && !locale) {\n locale = currentRoute.paramMap.get('locale');\n currentRoute = currentRoute.parent;\n }\n }\n }\n\n if (!locale) {\n locale = untracked(inject(TranslationStore).locale);\n }\n\n return locale;\n}\n","import {\n computed,\n inject,\n isDevMode,\n isSignal,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { type ResolveFn } from '@angular/router';\nimport {\n compileTranslation,\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n type inferCompiledTranslationNamespace,\n} from './compile';\nimport { replaceWithDelim } from './delim';\nimport { injectResolveParamLocale } from './resovler-locale';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport {\n injectDefaultLocale,\n injectIntlConfig,\n TranslationStore,\n} from './translation-store';\n\n \ntype AnyStringRecord = Record<string, any>;\n\nfunction createEqualsRecord<T extends AnyStringRecord>(keys: (keyof T)[] = []) {\n let keyMatcher: (a: T, b: T) => boolean;\n\n if (keys.length === 0) {\n keyMatcher = () => true;\n } else if (keys.length === 1) {\n const key = keys[0];\n keyMatcher = (a, b) => a[key] === b[key];\n } else {\n keyMatcher = (a, b) => {\n return keys.every((k) => a[k] === b[k]);\n };\n }\n\n return (a?: T, b?: T): boolean => {\n if (!a && !b) return true;\n if (!a || !b) return false;\n return keyMatcher(a, b);\n };\n}\n\ntype TFunction<TMap extends AnyStringRecord> = <\n TKey extends keyof TMap & string,\n>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [TMap[TKey]]\n) => string;\n\ntype SignalTFunction<TMap extends AnyStringRecord> = <\n TKey extends keyof TMap & string,\n>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [() => TMap[TKey]]\n) => Signal<string>;\n\ntype TFunctionWithSignalConstructor<\n TMap extends AnyStringRecord,\n TFN extends TFunction<TMap>,\n> = TFN & {\n asSignal: SignalTFunction<TMap>;\n};\n\nfunction addSignalFn<TMap extends AnyStringRecord, TFn extends TFunction<TMap>>(\n fn: TFn,\n store: TranslationStore,\n): TFunctionWithSignalConstructor<TMap, TFn> {\n const withSig = fn as TFunctionWithSignalConstructor<TMap, TFn>;\n\n const asSignal = <TKey extends keyof TMap & string>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [() => TMap[TKey]]\n ): Signal<string> => {\n const variables = args[0] as () => AnyStringRecord | undefined;\n const stringKey = key as string;\n\n const flatPath = replaceWithDelim(stringKey);\n\n const varsFn = variables ?? (() => undefined);\n const varsSignal = isSignal(varsFn)\n ? varsFn\n : computed(varsFn, {\n equal: createEqualsRecord(Object.keys(varsFn() ?? {})),\n });\n\n return computed(() => store.formatMessage(flatPath, varsSignal()));\n };\n\n withSig.asSignal = asSignal;\n\n return withSig;\n}\n\nexport function createT<TMap extends AnyStringRecord>(\n store: TranslationStore,\n): TFunction<TMap> {\n return <TKey extends keyof TMap & string>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [TMap[TKey]]\n ): string => {\n const variables = args[0] as AnyStringRecord | undefined;\n const stringKey = key as string;\n\n return store.formatMessage(replaceWithDelim(stringKey), variables);\n };\n}\n\nexport function registerNamespace<\n TDefault extends CompiledTranslation<UnknownStringKeyObject, string>,\n>(\n defaultTranslation: () => Promise<TDefault>,\n other: Record<\n string,\n () => Promise<\n CompiledTranslation<\n UnknownStringKeyObject,\n inferCompiledTranslationNamespace<TDefault>,\n string\n >\n >\n >,\n) {\n type $Map = inferCompiledTranslationMap<TDefault>;\n type $BaseTFN = TFunction<$Map>;\n type $TFN = TFunctionWithSignalConstructor<$Map, $BaseTFN>;\n\n const injectT = (): $TFN => {\n const store = inject(TranslationStore);\n\n return addSignalFn(createT(store), store);\n };\n\n let defaultTranslationLoaded = false;\n const resolver: ResolveFn<void> = async (snapshot) => {\n const store = inject(TranslationStore);\n\n const locale = injectResolveParamLocale(snapshot);\n\n const defaultLocale = injectDefaultLocale();\n const shouldPreloadDefault =\n injectIntlConfig()?.preloadDefaultLocale ?? false;\n\n const tPromise = other[locale] as (typeof other)[string] | undefined;\n\n const promise = tPromise ?? defaultTranslation;\n if (!promise && isDevMode()) {\n return console.warn(`No translation found for locale: ${locale}`);\n }\n\n if (promise === defaultTranslation && defaultTranslationLoaded) return;\n\n try {\n const promises = [promise()];\n\n if (\n shouldPreloadDefault &&\n !defaultTranslationLoaded &&\n promise !== defaultTranslation\n )\n promises.push(defaultTranslation());\n\n const translations = await Promise.allSettled(promises);\n\n const fullfilled = translations.map((t) =>\n t.status === 'fulfilled' ? t.value : null,\n );\n\n if (fullfilled.at(0) === null && fullfilled.at(1) === null)\n throw new Error('Failed to load translations');\n\n const [t, defaultT] = fullfilled;\n\n const ns = t?.namespace ?? defaultT?.namespace;\n if (!ns) throw new Error('No namespace found in translation');\n\n if (isDevMode() && t && t.locale !== locale && t.locale)\n console.warn(`Expected locale to be ${locale} but got ${t.locale}`);\n\n store.registerOnDemandLoaders(ns, {\n ...other,\n [defaultLocale]: defaultTranslation,\n });\n\n const toRegister: Record<string, Record<string, string>> = {};\n if (t) toRegister[locale] = t.flat;\n if (defaultT) toRegister[defaultLocale] = defaultT.flat;\n\n store.register(ns, toRegister);\n\n if (promise === defaultTranslation || defaultT)\n defaultTranslationLoaded = true;\n } catch {\n if (isDevMode()) {\n console.warn(`Failed to load translation for locale: ${locale}`);\n }\n } finally {\n if (locale !== untracked(store.locale)) store.locale.set(locale);\n }\n };\n\n return {\n injectNamespaceT: injectT,\n resolveNamespaceTranslation: resolver,\n };\n}\n\ntype UntypedTFunction<TNS extends string> = {\n (key: `${TNS}.${string}`, args?: Record<string, string>): string;\n asSignal: (\n key: `${TNS}.${string}`,\n args?: () => Record<string, string>,\n ) => Signal<string>;\n};\n\n/**\n * Registers a type-unsafe namespace, meant for remote loading of unknown key-value pairs using mmstack/translate infrastructure\n * The resolver & t function work the same as they would with typed namespaces, but without type safety\n */\nexport function registerRemoteNamespace<TNS extends string>(\n ns: TNS,\n defaultTranslation: () => Promise<Record<string, string>>,\n other: Record<string, () => Promise<Record<string, string>>>,\n) {\n const injectT = (): UntypedTFunction<TNS> => {\n const store = inject(TranslationStore);\n\n return addSignalFn(createT(store), store) as UntypedTFunction<TNS>;\n };\n\n let defaultTranslationLoaded = false;\n const resolver: ResolveFn<void> = async (snapshot) => {\n const store = inject(TranslationStore);\n\n const locale = injectResolveParamLocale(snapshot);\n\n const defaultLocale = injectDefaultLocale();\n const shouldPreloadDefault =\n injectIntlConfig()?.preloadDefaultLocale ?? false;\n\n const tPromise = other[locale] as (typeof other)[string] | undefined;\n\n const promise = tPromise ?? defaultTranslation;\n\n if (!promise && isDevMode()) {\n return console.warn(`No translation found for locale: ${locale}`);\n }\n\n if (promise === defaultTranslation && defaultTranslationLoaded) return;\n\n try {\n const promises = [promise()];\n\n if (\n shouldPreloadDefault &&\n !defaultTranslationLoaded &&\n promise !== defaultTranslation\n )\n promises.push(defaultTranslation());\n\n const translations = await Promise.allSettled(promises);\n\n const fullfilled = translations.map((t) =>\n t.status === 'fulfilled' ? t.value : null,\n );\n\n if (fullfilled.at(0) === null && fullfilled.at(1) === null)\n throw new Error('Failed to load translations');\n\n const [baseT, baseDefaultT] = fullfilled;\n\n const t = baseT ? compileTranslation(baseT, ns, locale) : null;\n const defaultT = baseDefaultT\n ? compileTranslation(baseDefaultT, ns, defaultLocale)\n : null;\n\n if (isDevMode() && t && t.locale !== locale && t.locale)\n console.warn(`Expected locale to be ${locale} but got ${t.locale}`);\n\n store.registerOnDemandLoaders(ns, {\n ...other,\n [defaultLocale]: defaultTranslation,\n });\n\n const toRegister: Record<string, Record<string, string>> = {};\n if (t) toRegister[locale] = t.flat;\n if (defaultT) toRegister[defaultLocale] = defaultT.flat;\n\n store.register(ns, toRegister);\n\n if (promise === defaultTranslation || defaultT)\n defaultTranslationLoaded = true;\n } catch {\n if (isDevMode()) {\n console.warn(`Failed to load translation for locale: ${locale}`);\n }\n } finally {\n if (locale !== untracked(store.locale)) store.locale.set(locale);\n }\n };\n\n return {\n injectNamespaceT: injectT,\n resolveNamespaceTranslation: resolver,\n };\n}\n","import { inject } from '@angular/core';\nimport {\n Router,\n type CanMatchFn,\n type Route,\n type UrlSegment,\n} from '@angular/router';\nimport {\n injectDefaultLocale,\n injectSupportedLocales,\n} from './translation-store';\n\n/**\n * Guard that validates the locale parameter against supported locales.\n * Redirects to default locale if the locale is invalid.\n *\n * @param prefixSegments Optional array of path segments preceding the locale segment.\n * if (you wanted to match /app/:locale/... you would pass ['app'] here) & the function would match the second parameter + redirect accordingly\n *\n * @example\n * ```typescript\n * {\n * path: ':locale',\n * canMatch: [canMatchLocale()],\n * children: [...]\n * }\n * ```\n */\nexport function canMatchLocale(prefixSegments: string[] = []): CanMatchFn {\n return (_route: Route, segments: UrlSegment[]) => {\n const supportedLocales = injectSupportedLocales();\n\n const locale = segments.at(prefixSegments.length)?.path;\n\n if (!locale || !supportedLocales.includes(locale))\n return inject(Router).createUrlTree([\n ...prefixSegments,\n injectDefaultLocale(),\n ]);\n\n return true;\n };\n}\n","import {\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n Renderer2,\n} from '@angular/core';\nimport {\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n} from './compile';\nimport { createT } from './register-namespace';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport { TranslationStore } from './translation-store';\n\n@Directive()\nexport abstract class Translate<\n TInput extends string,\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>,\n TKey extends TInput & keyof TMap & string = TInput & keyof TMap & string,\n> {\n private readonly t = createT(inject(TranslationStore));\n\n readonly translate =\n input.required<\n TMap[TKey] extends void\n ? TKey | [key: TKey]\n : [key: TKey, vars: TMap[TKey]]\n >();\n\n constructor() {\n const key = computed(() => {\n const vars = this.translate();\n return (Array.isArray(vars) ? vars[0] : vars) as TKey;\n });\n\n const args = computed(\n () => {\n const vars = this.translate();\n return (Array.isArray(vars) ? vars[1] : undefined) as TMap[TKey];\n },\n {\n equal: (a, b) => {\n if (a === undefined && b === undefined) return true;\n if (a === undefined || b === undefined) return false;\n\n const aObj = a as Record<string, string>;\n const keys = Object.keys(aObj);\n const bObj = b as Record<string, string>;\n\n if (!keys.length) return !Object.keys(bObj).length;\n\n return keys.every((key) => aObj[key] === bObj[key]);\n },\n },\n );\n\n const translation = computed(() => this.t(key(), args()));\n\n const renderer = inject(Renderer2);\n const el = inject<ElementRef<HTMLElement>>(ElementRef);\n\n afterRenderEffect({\n write: () => {\n renderer.setProperty(el.nativeElement, 'textContent', translation());\n },\n });\n }\n}\n","import { ChangeDetectorRef, effect, inject } from '@angular/core';\nimport { type CompiledTranslation, type inferCompiledTranslationMap } from './compile';\nimport { createT } from './register-namespace';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport { TranslationStore } from './translation-store';\n\nexport abstract class Translator<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>,\n> {\n private readonly store = inject(TranslationStore);\n private readonly t = createT<TMap>(this.store);\n\n constructor() {\n const cdr = inject(ChangeDetectorRef);\n\n effect(() => {\n this.store.locale();\n cdr.markForCheck();\n });\n }\n\n transform<K extends keyof TMap & string>(\n key: K,\n ...args: TMap[K] extends void\n ? [locale?: string]\n : [TMap[K], locale?: string]\n ): string {\n const actualArgs = args.filter(\n (a) => typeof a === 'object',\n ) as TMap[K] extends void ? [] : [TMap[K]];\n\n return this.t(key, ...actualArgs);\n }\n}\n","import { type Provider, signal } from '@angular/core';\nimport { createIntl, createIntlCache, type IntlShape } from '@formatjs/intl';\nimport { compileTranslation } from '../compile';\nimport { type UnknownStringKeyObject } from '../string-key-object.type';\nimport { TranslationStore } from '../translation-store';\n\n/**\n * Options designed to feed into the mock translations function.\n */\nexport interface MockTranslationOptions {\n /**\n * If provided, allows overriding the default behavior of simply echoing translation keys back.\n * Format: Record of namespace -> (Translation shape similar to what you pass to `createNamespace`)\n *\n * Example:\n * ```ts\n * {\n * home: { title: 'Mocked Title' },\n * auth: { error: 'Mocked Error' }\n * }\n * ```\n */\n translations?: Record<string, UnknownStringKeyObject>;\n\n /**\n * When true, uses `@formatjs/intl` to process ICU message syntax (e.g. `{name}`, plurals, selects).\n * This gives you real variable interpolation in your test assertions.\n *\n * @default false β€” values are ignored and the raw message string is returned.\n *\n * @example\n * ```ts\n * provideMockTranslations({\n * translations: { home: { greet: 'Hello {name}' } },\n * formatValues: true,\n * })\n * // t('home.greet', { name: 'Alice' }) β†’ 'Hello Alice'\n * ```\n */\n formatValues?: boolean;\n\n /**\n * The locale to use when `formatValues` is true.\n * @default 'en-US'\n */\n locale?: string;\n}\n\n/**\n * Provides an isolated mock `TranslationStore` usable across testing modules that use components\n * depending on `@mmstack/translate` APIs (like `Translate` directive, `Translator` pipe, or `injectNamespaceT`).\n *\n * This provider intercepts all translation logic, bypassing chunk loaders and Intl.\n * When a custom configuration isn't provided, formatMessage simply echoes the translation key, using dots `.`.\n *\n * ### Usage\n * ```typescript\n * TestBed.configureTestingModule({\n * providers: [provideMockTranslations()]\n * });\n * ```\n */\nexport function provideMockTranslations(\n options?: MockTranslationOptions,\n): Provider[] {\n // We compile the mock strings to flat delimiters just like the internal compile module.\n const mappedMocks: Record<string, string> = {};\n\n if (options?.translations) {\n for (const [namespace, translationObj] of Object.entries(\n options.translations,\n )) {\n const compiled = compileTranslation(translationObj, namespace);\n\n for (const [key, val] of Object.entries(compiled.flat)) {\n // e.g. from 'home::MMT_DELIM::title'\n const fullKey = `${namespace}::MMT_DELIM::${key}`;\n mappedMocks[fullKey] = val;\n }\n }\n }\n\n const locale = options?.locale ?? 'en-US';\n\n let intl: IntlShape | undefined;\n\n if (options?.formatValues) {\n intl = createIntl({ locale, messages: mappedMocks }, createIntlCache());\n }\n\n return [\n {\n provide: TranslationStore,\n useValue: {\n locale: signal(locale),\n formatMessage: (\n key: string,\n values?: Record<string, string | number>,\n ) => {\n const message = mappedMocks[key];\n\n if (!message) {\n // Fallback to echoing the key back in dot notation (more readable for unit assertions).\n return key.replaceAll('::MMT_DELIM::', '.');\n }\n\n if (intl) {\n return intl.formatMessage(\n { id: key, defaultMessage: message },\n values,\n );\n }\n\n return message;\n },\n hasLocaleLoaders: () => false,\n register: () => {\n // noop\n },\n registerOnDemandLoaders: () => {\n // noop\n },\n dynamicLocaleLoader: {\n isLoading: signal(false),\n value: signal(null),\n error: signal(null),\n },\n loadQueue: signal([]),\n },\n },\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["cache","getFormatter"],"mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,eAAe;AAE3B,SAAU,YAAY,CAAC,MAAc,EAAE,GAAW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AM,CAAC;AACtB,gBAAA,aAAa,EAAE,CACb,GAAW,EACX,MAAwC,KACtC;AACF,oBAAA,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC;oBAEhC,IAAI,CAAC,OAAO,EAAE;;wBAEZ,OAAO,GAAG,CAAC,UAAU,CAAC,eAAe,EAAE,GAAG,CAAC;oBAC7C;oBAEA,IAAI,IAAI,EAAE;AACR,wBAAA,OAAO,IAAI,CAAC,aAAa,CACvB,EAAE,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,EACpC,MAAM,CACP;oBACH;AAEA,oBAAA,OAAO,OAAO;gBAChB,CAAC;AACD,gBAAA,gBAAgB,EAAE,MAAM,KAAK;gBAC7B,QAAQ,EAAE,MAAK;;gBAEf,CAAC;gBACD,uBAAuB,EAAE,MAAK;;gBAE9B,CAAC;AACD,gBAAA,mBAAmB,EAAE;AACnB,oBAAA,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC;AACxB,oBAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC;AACnB,oBAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC;AACpB,iBAAA;AACD,gBAAA,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;AACtB,aAAA;AACF,SAAA;KACF;AACH;;ACnIA;;AAEG;;;;"}
1
+ {"version":3,"file":"mmstack-translate.mjs","sources":["../../../../packages/translate/src/lib/delim.ts","../../../../packages/translate/src/lib/compile.ts","../../../../packages/translate/src/lib/create-namespace.ts","../../../../packages/translate/src/lib/path-param.ts","../../../../packages/translate/src/lib/translation-store.ts","../../../../packages/translate/src/lib/format/unwrap.ts","../../../../packages/translate/src/lib/format/date.ts","../../../../packages/translate/src/lib/format/display-name.ts","../../../../packages/translate/src/lib/format/list.ts","../../../../packages/translate/src/lib/format/numeric.ts","../../../../packages/translate/src/lib/format/relative-time.ts","../../../../packages/translate/src/lib/resovler-locale.ts","../../../../packages/translate/src/lib/register-namespace.ts","../../../../packages/translate/src/lib/route-helpers.ts","../../../../packages/translate/src/lib/translate.ts","../../../../packages/translate/src/lib/translator.ts","../../../../packages/translate/src/lib/testing/provide-mock-translations.ts","../../../../packages/translate/src/mmstack-translate.ts"],"sourcesContent":["const KEY_DELIM = '::MMT_DELIM::';\n\nexport function prependDelim(prefix: string, key: string): string {\n return `${prefix}${KEY_DELIM}${key}`;\n}\n\nexport function replaceWithDelim(str: string, repl = '.'): string {\n return str.replaceAll(repl, KEY_DELIM);\n}\n","import { prependDelim } from './delim';\nimport type {\n inferTranslationParamMap,\n inferTranslationShape,\n} from './parameterize.type';\nimport type { UnknownStringKeyObject } from './string-key-object.type';\n\nconst INTERNAL_SYMBOL = Symbol.for('mmstack-translate-internal');\n\ntype InternalSymbol = typeof INTERNAL_SYMBOL;\n\nexport type CompiledTranslation<\n T extends UnknownStringKeyObject,\n TNS extends string,\n TLocale extends string = string,\n> = {\n flat: Record<string, string>;\n locale?: TLocale;\n namespace: TNS;\n [INTERNAL_SYMBOL]: {\n shape: inferTranslationShape<T>;\n map: inferTranslationParamMap<TNS, T>;\n };\n};\n\nexport type mergeTranslationMaps<\n TMain extends CompiledTranslation<UnknownStringKeyObject, string>,\n TOther extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = Omit<TMain, InternalSymbol> & {\n [INTERNAL_SYMBOL]: {\n shape: inferCompiledTranslationShape<TMain>;\n map: inferCompiledTranslationMap<TOther> &\n inferCompiledTranslationMap<TMain>;\n };\n};\n\nexport type inferCompiledTranslationNamespace<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T['namespace'];\n\nexport type inferCompiledTranslationShape<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T[InternalSymbol]['shape'];\n\nexport type inferCompiledTranslationMap<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T[InternalSymbol]['map'];\n\nfunction isTranslationObject(t: unknown): t is UnknownStringKeyObject {\n return typeof t === 'object' && t !== null;\n}\n\nfunction flattenTranslation<T extends UnknownStringKeyObject>(obj: T) {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n if (typeof value === 'string') {\n acc[key] = value;\n } else if (isTranslationObject(value)) {\n Object.entries(flattenTranslation(value)).forEach(\n ([nestedKey, nestedValue]) => {\n acc[prependDelim(key, nestedKey)] = nestedValue;\n },\n );\n }\n\n return acc;\n },\n {} as Record<string, string>,\n );\n}\n\nexport function compileTranslation<\n T extends UnknownStringKeyObject,\n TNS extends string,\n TLocale extends string = string,\n>(\n translation: T,\n ns: TNS,\n locale?: TLocale,\n): CompiledTranslation<T, TNS, TLocale> {\n type $Shape = inferTranslationShape<T>;\n type $Map = inferTranslationParamMap<TNS, T>;\n\n return {\n locale,\n flat: flattenTranslation(translation),\n namespace: ns,\n [INTERNAL_SYMBOL]: {\n shape: {} as $Shape,\n map: {} as $Map,\n },\n };\n}\n","import {\n type CompiledTranslation,\n compileTranslation,\n type inferCompiledTranslationShape,\n type mergeTranslationMaps,\n} from './compile';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\n\ntype TranslationNamespace<\n TNS extends string,\n T extends CompiledTranslation<UnknownStringKeyObject, TNS>,\n TShape extends UnknownStringKeyObject,\n> = {\n translation: T;\n createTranslation: <TLocale extends string>(\n locale: TLocale,\n translation: TShape,\n ) => CompiledTranslation<TShape, TNS, TLocale>;\n createMergedNamespace: <\n TOtherNS extends string,\n const TOther extends UnknownStringKeyObject,\n TOtherCompiled extends CompiledTranslation<TOther, TOtherNS>,\n >(\n ns: TOtherNS,\n translation: TOther,\n ) => TranslationNamespace<\n TOtherNS,\n mergeTranslationMaps<TOtherCompiled, T>,\n inferCompiledTranslationShape<TOtherCompiled>\n >;\n};\n\nexport function createNamespace<\n const T extends UnknownStringKeyObject,\n TNS extends string,\n>(ns: TNS, translation: T) {\n const compiled = compileTranslation<T, TNS>(translation, ns);\n\n type TCompiled = typeof compiled;\n type TShape = inferCompiledTranslationShape<typeof compiled>;\n\n const namespace: TranslationNamespace<TNS, TCompiled, TShape> = {\n translation: compiled,\n createTranslation: <TLocale extends string>(\n locale: TLocale,\n translation: TShape,\n ) => {\n return compileTranslation(translation, ns, locale);\n },\n createMergedNamespace: <\n TOther extends UnknownStringKeyObject,\n TOtherNS extends string,\n TOtherCompiled extends CompiledTranslation<TOther, TOtherNS> =\n CompiledTranslation<TOther, TOtherNS>,\n >(\n otherNs: TOtherNS,\n otherTranslation: TOther,\n ) => {\n return createNamespace(otherNs, otherTranslation) as TranslationNamespace<\n TOtherNS,\n mergeTranslationMaps<TOtherCompiled, TCompiled>,\n inferCompiledTranslationShape<TOtherCompiled>\n > as unknown as any;\n },\n };\n\n return namespace;\n}\n","import { computed, inject, type Signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, type ParamMap, Router } from '@angular/router';\n\nexport function pathParam(\n key: string | (() => string),\n route = inject(ActivatedRoute),\n): Signal<string | null> {\n const keySignal =\n typeof key === 'string' ? computed(() => key) : computed(key);\n\n const routerOptions = inject(Router)['options'];\n\n if (\n routerOptions &&\n typeof routerOptions === 'object' &&\n routerOptions.paramsInheritanceStrategy === 'always'\n ) {\n const params = toSignal(route.paramMap, {\n initialValue: route.snapshot.paramMap,\n });\n\n return computed(() => params().get(keySignal()));\n }\n\n const paramMapSignals: Signal<ParamMap>[] = [];\n let currentRoute: ActivatedRoute | null = route;\n\n const isStatic = typeof key === 'string';\n\n while (currentRoute) {\n const initial = currentRoute.snapshot.paramMap;\n paramMapSignals.push(\n toSignal(currentRoute.paramMap, {\n initialValue: initial,\n }),\n );\n\n // For static keys, stop once we find the param, will find first in computed for loop already so basically noop for for loop\n if (isStatic && initial.has(key as string)) break;\n\n currentRoute = currentRoute.parent;\n }\n\n return computed(() => {\n const paramKey = keySignal();\n\n for (const map of paramMapSignals) {\n const v = map().get(paramKey);\n if (v) return v;\n }\n\n return null;\n });\n}\n","import {\n computed,\n effect,\n inject,\n Injectable,\n InjectionToken,\n isDevMode,\n LOCALE_ID,\n type Provider,\n resource,\n type Signal,\n signal,\n untracked,\n type WritableSignal,\n} from '@angular/core';\nimport { createIntl, createIntlCache, type IntlConfig } from '@formatjs/intl';\nimport { type CompiledTranslation } from './compile';\nimport { prependDelim } from './delim';\nimport { pathParam } from './path-param';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\n\nconst CONFIG_TOKEN = new InjectionToken<\n Omit<IntlConfig, 'locale' | 'messages'> & {\n supportedLocales?: string[];\n preloadDefaultLocale?: boolean;\n localeParamName?: string;\n }\n>('mmstack-intl-config');\n\nexport function provideIntlConfig(\n config: Omit<IntlConfig, 'locale' | 'messages'> & {\n /** Checks next locale is in provided array before switching locales */\n supportedLocales?: string[];\n /** Preloads the default locale ensuring sync fallback, not necessary for most cases as it will lazily load automatically when needed */\n preloadDefaultLocale?: boolean;\n /** Auto-resolution when using a locale parameter via angular router */\n localeParamName?: string;\n },\n): Provider[] {\n const providers: Provider[] = [\n {\n useFactory: (localeId: string) => {\n const next = {\n ...config,\n };\n\n const defaultLocale =\n config.defaultLocale ?? config.supportedLocales?.at(0) ?? localeId;\n\n if (\n next.supportedLocales &&\n !next.supportedLocales.includes(defaultLocale)\n ) {\n next.supportedLocales = [...next.supportedLocales, defaultLocale];\n }\n\n return next;\n },\n deps: [LOCALE_ID],\n provide: CONFIG_TOKEN,\n },\n ];\n\n const defaultLocale = config.defaultLocale ?? config.supportedLocales?.at(0);\n\n if (!defaultLocale) return providers;\n\n providers.push({\n provide: LOCALE_ID,\n useValue: defaultLocale,\n });\n\n return providers;\n}\n\nexport function injectIntlConfig() {\n return inject(CONFIG_TOKEN, { optional: true }) ?? undefined;\n}\n\nexport function injectDefaultLocale() {\n return injectIntlConfig()?.defaultLocale ?? inject(LOCALE_ID) ?? 'en-US';\n}\n\nexport function injectSupportedLocales() {\n return injectIntlConfig()?.supportedLocales ?? [injectDefaultLocale()];\n}\n\n/**\n * @internal\n * the actual locale signal used to store the current locale string\n */\nconst STORE_LOCALE = signal('en-US');\n\nexport function injectLocaleInternal() {\n return STORE_LOCALE;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TranslationStore {\n private readonly cache = createIntlCache();\n private readonly config = injectIntlConfig();\n readonly loadQueue = signal<string[]>([]);\n readonly locale: WritableSignal<string>;\n private readonly defaultLocale = injectDefaultLocale();\n private readonly translations = signal<\n Record<string, Record<string, string>>\n >({\n [this.defaultLocale]: {},\n });\n private attemptedFallbackLoad = false;\n\n private readonly onDemandLoaders = new Map<\n string,\n Record<\n string,\n () => Promise<CompiledTranslation<UnknownStringKeyObject, string>>\n >\n >();\n\n private readonly nonMessageConfig = computed(() => ({\n ...this.config,\n locale: this.locale(),\n }));\n\n private readonly messages = computed(\n () =>\n this.translations()[this.locale()] ??\n this.translations()[this.defaultLocale] ??\n {},\n );\n\n readonly dynamicLocaleLoader = resource({\n params: computed(() => this.loadQueue().at(0) ?? null),\n loader: async ({ params: newLocale, abortSignal }) => {\n if (!newLocale) return;\n\n const currentTranslations = untracked(this.translations);\n\n const loadPromises: Promise<{\n namespace: string;\n flat: Record<string, string>;\n } | null>[] = [];\n\n for (const [namespace, loaders] of this.onDemandLoaders.entries()) {\n const loader = loaders[newLocale];\n if (loader) {\n const hasNamespaceForLocale =\n currentTranslations[newLocale] &&\n Object.keys(currentTranslations[newLocale]).some((key) =>\n key.startsWith(`${prependDelim(namespace, '').slice(0, -1)}`),\n );\n\n if (!hasNamespaceForLocale) {\n loadPromises.push(\n loader()\n .then((translation) => {\n if (abortSignal.aborted) return null;\n return {\n namespace: translation.namespace,\n flat: translation.flat,\n };\n })\n .catch((err) => {\n if (isDevMode()) {\n console.error(\n '[Translate] Failed to load',\n namespace,\n newLocale,\n err,\n );\n }\n\n return null;\n }),\n );\n }\n }\n }\n\n return Promise.all(loadPromises)\n .then((res) => res.filter((r) => r !== null))\n .then((res) => ({\n locales: res,\n locale: newLocale,\n }));\n },\n });\n\n readonly intl = computed(() =>\n createIntl(\n {\n ...this.nonMessageConfig(),\n messages: this.messages(),\n },\n this.cache,\n ),\n );\n\n constructor() {\n this.locale = STORE_LOCALE;\n this.locale.set(injectDefaultLocale());\n const paramName = this.config?.localeParamName;\n if (paramName) {\n const param = pathParam(paramName);\n\n effect(() => {\n const loc = param();\n if (\n !loc ||\n loc === untracked(this.locale) ||\n untracked(this.loadQueue).includes(loc)\n )\n return;\n if (this.hasLocaleLoaders(loc)) this.locale.set(loc);\n else this.loadQueue.update((q) => [...q, loc]);\n });\n }\n\n effect(() => {\n if (\n // should never be in error state, but best to check in case something throws\n this.dynamicLocaleLoader.error() ||\n this.dynamicLocaleLoader.isLoading()\n )\n return;\n const dynamicLocales = this.dynamicLocaleLoader.value();\n\n if (!dynamicLocales) return;\n\n // Register loaded translations\n for (const locale of dynamicLocales.locales) {\n this.register(locale.namespace, {\n [dynamicLocales.locale]: locale.flat,\n });\n }\n\n const hasTranslations =\n dynamicLocales.locales.length > 0 ||\n this.translations()[dynamicLocales.locale];\n\n if (hasTranslations) {\n this.loadQueue.update((q) =>\n q.filter((l) => l !== dynamicLocales.locale),\n );\n this.locale.set(dynamicLocales.locale);\n }\n });\n }\n\n formatMessage(key: string, values?: Record<string, string | number>) {\n const message =\n this.translations()[this.locale()]?.[key] ??\n this.translations()[this.defaultLocale]?.[key] ??\n '';\n\n if (!message) {\n if (this.attemptedFallbackLoad) return '';\n\n this.attemptedFallbackLoad = true;\n untracked(() => {\n if (!this.loadQueue().includes(this.defaultLocale))\n this.loadQueue.update((q) => [...q, this.defaultLocale]);\n });\n return '';\n }\n\n return this.intl().formatMessage(\n { id: key, defaultMessage: message },\n values,\n );\n }\n\n register(\n namespace: string,\n flat: Partial<Record<string, Record<string, string>>>,\n ) {\n this.translations.update((cur) => {\n return Object.entries(flat).reduce(\n (acc, [locale, translation]) => {\n const localeTranslation = acc[locale] ?? {};\n\n const withNS = Object.entries(translation ?? {}).reduce(\n (acc, [key, value]) => {\n acc[prependDelim(namespace, key)] = value;\n return acc;\n },\n {} as Record<string, string>,\n );\n\n acc[locale] = {\n ...localeTranslation,\n ...withNS,\n };\n\n return acc;\n },\n { ...cur },\n );\n });\n }\n\n registerOnDemandLoaders(\n namespace: string,\n loaders: Record<string, () => Promise<any>>,\n ) {\n this.onDemandLoaders.set(namespace, loaders);\n }\n\n hasLocaleLoaders(locale: string): boolean {\n return Array.from(this.onDemandLoaders.values()).some(\n (loaders) => loaders[locale],\n );\n }\n}\n\nexport function injectIntl() {\n return inject(TranslationStore).intl;\n}\n\n/**\n * Inject a dynamic locale signal that supports runtime language switching.\n *\n * @returns A writable signal with the current locale and loading state.\n * Only allows switching to locales that have registered loaders.\n *\n * @example\n * ```typescript\n * const locale = injectDynamicLocale();\n *\n * // Switch language (triggers automatic translation loading)\n * locale.set('sl-SI');\n *\n * // Check loading state\n * if (locale.isLoading()) {\n * // Show spinner\n * }\n * ```\n */\nexport function injectDynamicLocale(): WritableSignal<string> & {\n isLoading: Signal<boolean>;\n} {\n const store = inject(TranslationStore);\n const supportedLocales = injectIntlConfig()?.supportedLocales;\n\n const source = computed(() => store.locale()) as WritableSignal<string> & {\n isLoading: Signal<boolean>;\n };\n\n const inSupportedLocales =\n supportedLocales === undefined\n ? () => true\n : (locale: string) => supportedLocales.includes(locale);\n\n const set = (value: string) => {\n if (\n value === untracked(source) ||\n untracked(store.loadQueue).includes(value)\n )\n return;\n\n if (!inSupportedLocales(value)) {\n if (isDevMode())\n console.warn(\n `[Translate] Locale \"${value}\" is not in supportedLocales, switch prevented. Available options are:`,\n supportedLocales,\n );\n\n return;\n }\n\n if (isDevMode() && !store.hasLocaleLoaders(value))\n console.warn(\n `[Translate] No loaders registered for locale \"${value}\". Switching to this locale will have no effect.`,\n );\n\n store.loadQueue.update((q) => [...q, value]);\n };\n\n source.set = set;\n source.update = (updater: (value: string) => string) => {\n const next = updater(untracked(source));\n source.set(next);\n };\n source.asReadonly = () => source;\n\n source.isLoading = store.dynamicLocaleLoader.isLoading;\n\n return source;\n}\n","import { isSignal, type Signal } from '@angular/core';\n\nexport function unwrap<T>(value: T | Signal<T>): T {\n return isSignal(value) ? value() : value;\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst FORMAT_PRESETS: Record<string, Intl.DateTimeFormatOptions> = {\n short: { dateStyle: 'short', timeStyle: 'short' },\n medium: { dateStyle: 'medium', timeStyle: 'medium' },\n long: { dateStyle: 'long', timeStyle: 'long' },\n full: { dateStyle: 'full', timeStyle: 'full' },\n\n shortDate: { dateStyle: 'short' },\n mediumDate: { dateStyle: 'medium' },\n longDate: { dateStyle: 'long' },\n fullDate: { dateStyle: 'full' },\n\n shortTime: { timeStyle: 'short' },\n mediumTime: { timeStyle: 'medium' },\n longTime: { timeStyle: 'long' },\n fullTime: { timeStyle: 'full' },\n};\n\ntype DateFormat = keyof typeof FORMAT_PRESETS;\n\n/**\n * Supported date inputs\n */\nexport type SupportedDateInput = Date | string | number | null | undefined;\n\n/**\n * Options for formatting a date\n */\nexport type FormatDateOptions = {\n /**\n * Timezone to use for formatting\n */\n tz?: string;\n /**\n * Format to use for formatting\n * @default 'medium'\n */\n format?: DateFormat;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction validDateOrNull(\n date: Date | string | number | null | undefined,\n): Date | null {\n if (date == null) return null;\n\n const d = date instanceof Date ? date : new Date(date);\n return isNaN(d.getTime()) ? null : d;\n}\n\nconst cache = new Map<string, Intl.DateTimeFormat>();\n\nfunction getFormatter(\n locale: string,\n format: DateFormat,\n timeZone?: string,\n): Intl.DateTimeFormat {\n const cacheKey = `${locale}|${format}|${timeZone ?? ''}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(locale, {\n ...FORMAT_PRESETS[format],\n timeZone,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a date using the current or provided locale & timezone\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param date - Date to format\n * @param opt - Options for formatting\n * @returns Formatted date string\n */\nexport function formatDate(\n date: SupportedDateInput | Signal<SupportedDateInput>,\n opt?: FormatDateOptions | Signal<FormatDateOptions>,\n): string {\n const validDate = validDateOrNull(unwrap(date));\n if (validDate === null) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.format ?? 'medium',\n unwrappedOpt?.tz,\n ).format(validDate);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst cache = new Map<string, Intl.DisplayNames>();\n\n/**\n * Options for formatting a display name\n */\nexport type FormatDisplayNameOptions = {\n /**\n * The display style for the result set\n */\n style: Intl.RelativeTimeFormatStyle;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction getFormatter(\n locale: string,\n type: Intl.DisplayNamesType,\n style: Intl.RelativeTimeFormatStyle,\n): Intl.DisplayNames {\n const cacheKey = `${locale}|${type}|${style}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.DisplayNames(locale, {\n type,\n style,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\ntype SupportedCode = string | null | undefined;\n\n/**\n * Format a display name using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The code to format\n * @param type - The type of display name to format\n * @param opt - Options for formatting\n * @returns Formatted display name string\n */\nexport function formatDisplayName(\n value: SupportedCode | Signal<SupportedCode>,\n type: Intl.DisplayNamesType | Signal<Intl.DisplayNamesType>,\n opt?: FormatDisplayNameOptions | Signal<FormatDisplayNameOptions>,\n): string {\n const unwrapped = unwrap(value);\n if (!unwrapped?.trim()) return '';\n\n const unwrappedType = unwrap(type);\n const unwrappedOpt = unwrap(opt);\n\n const locale = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return (\n getFormatter(locale, unwrappedType, unwrappedOpt?.style ?? 'long').of(\n unwrapped,\n ) ?? ''\n );\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\ntype ListType = 'conjunction' | 'disjunction' | 'unit';\ntype ListStyle = 'long' | 'short' | 'narrow';\n\nexport type SupportedListInput = string[] | null | undefined;\n\nconst cache = new Map<string, Intl.ListFormat>();\n\n/**\n * Options for formatting a list\n */\nexport type FormatListOptions = {\n /**\n * The type of list to format\n */\n type?: ListType;\n /**\n * The style of list to format\n */\n style?: ListStyle;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nconst EMPTY_ARRAY: string[] = [];\n\nfunction unwrapList(\n value: SupportedListInput | Signal<SupportedListInput>,\n): string[] {\n const unwrapped = unwrap(value);\n return Array.isArray(unwrapped) ? unwrapped : EMPTY_ARRAY;\n}\n\nfunction getFormatter(\n locale: string,\n type: ListType,\n style: ListStyle,\n): Intl.ListFormat {\n const cacheKey = `${locale}|${type}|${style}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.ListFormat(locale, { type, style });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a list using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The list to format\n * @param opt - Options for formatting\n * @returns Formatted list string\n */\nexport function formatList(\n value: SupportedListInput | Signal<SupportedListInput>,\n opt?: FormatListOptions | Signal<FormatListOptions>,\n): string {\n const unwrapped = unwrapList(value);\n if (unwrapped.length === 0) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.type ?? 'conjunction',\n unwrappedOpt?.style ?? 'long',\n ).format(unwrapped);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\ntype NumberNotation = 'standard' | 'scientific' | 'engineering' | 'compact';\n\ntype SupportedNumberValue = number | null | undefined;\n\nconst cache = new Map<string, Intl.NumberFormat>();\n\nfunction unwrapValue(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n fallbackToZero = false,\n): number | null {\n const unwrapped = unwrap(value);\n\n if (unwrapped === null || unwrapped === undefined || isNaN(unwrapped))\n return fallbackToZero ? 0 : null;\n\n return unwrapped;\n}\n\n/**\n * Options for formatting a number\n */\nexport type FormatNumberOptions = {\n /**\n * The notation to use for formatting\n */\n notation?: NumberNotation;\n /**\n * Minimum number of fraction digits to use\n */\n minFractionDigits?: number;\n /**\n * Maximum number of fraction digits to use\n */\n maxFractionDigits?: number;\n /**\n * Whether to use grouping\n */\n useGrouping?: boolean;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\nfunction getFormatter(\n locale: string,\n minFractionDigits: number | undefined,\n maxFractionDigits: number | undefined,\n useGrouping?: boolean,\n notation?: NumberNotation,\n currency?: string,\n display?: CurrencyDisplay,\n style?: 'currency' | 'percent',\n): Intl.NumberFormat {\n const cacheKey = `${locale}|${notation ?? 'standard'}|${minFractionDigits}|${maxFractionDigits}|${useGrouping ?? true}|${currency ?? 'none'}|${display ?? 'none'}|${style ?? 'decimal'}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, {\n style,\n notation,\n minimumFractionDigits: minFractionDigits,\n maximumFractionDigits: maxFractionDigits,\n useGrouping,\n currency,\n currencyDisplay: display,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a number using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param number - Number to format\n * @param opt - Options for formatting\n * @returns Formatted number string\n */\nexport function formatNumber(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n opt?: FormatNumberOptions | Signal<FormatNumberOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedNumber === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.minFractionDigits,\n unwrappedOpt?.maxFractionDigits,\n unwrappedOpt?.useGrouping ?? true,\n unwrappedOpt?.notation ?? 'standard',\n ).format(unwrappedNumber);\n}\n\n/**\n * Options for formatting a percentage value\n */\nexport type FormatPercentOptions = {\n /**\n * Minimum number of fraction digits to use\n */\n minFractionDigits?: number;\n /**\n * Maximum number of fraction digits to use\n */\n maxFractionDigits?: number;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\n/**\n * Format a percentage using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param number - Number to format\n * @param opt - Options for formatting\n * @returns Formatted percentage string\n */\nexport function formatPercent(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n opt?: FormatPercentOptions | Signal<FormatPercentOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n\n const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedNumber === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.minFractionDigits,\n unwrappedOpt?.maxFractionDigits,\n undefined,\n undefined,\n undefined,\n undefined,\n 'percent',\n ).format(unwrappedNumber);\n}\n\ntype CurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name';\n\n/**\n * Options for formatting a currency\n */\nexport type FormatCurrencyOptions = {\n /*\n * The display type for the currency format\n */\n display?: CurrencyDisplay;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\nexport function formatCurrency(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n currency: string | Signal<string>,\n opt?: FormatCurrencyOptions | Signal<FormatCurrencyOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n const unwrappedValue = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedValue === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n undefined,\n undefined,\n undefined,\n undefined,\n unwrap(currency),\n unwrappedOpt?.display ?? 'symbol',\n 'currency',\n ).format(unwrappedValue);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst cache = new Map<string, Intl.RelativeTimeFormat>();\n\n/**\n * Options for formatting a relative time value\n */\nexport type FormatRelativeTimeOptions = {\n /**\n * The length of the internationalized message.\n * @default 'long'\n */\n style?: Intl.RelativeTimeFormatStyle;\n /**\n * Controls whether to use numeric values in the output.\n * @default 'always'\n */\n numeric?: Intl.RelativeTimeFormatNumeric;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction getFormatter(\n locale: string,\n style: Intl.RelativeTimeFormatStyle,\n numeric: Intl.RelativeTimeFormatNumeric,\n): Intl.RelativeTimeFormat {\n const cacheKey = `${locale}|${style}|${numeric}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.RelativeTimeFormat(locale, { style, numeric });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\nexport type RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\ntype SupportedRelativeTimeInput = number | null | undefined;\n\n/**\n * Format a relative time using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The numeric value to use in the relative time internationalization message\n * @param unit - The unit to use in the relative time internationalization message\n * @param opt - Options for formatting\n * @returns Formatted relative time string\n */\nexport function formatRelativeTime(\n value: SupportedRelativeTimeInput | Signal<SupportedRelativeTimeInput>,\n unit: RelativeTimeUnit | Signal<RelativeTimeUnit>,\n opt?: FormatRelativeTimeOptions | Signal<FormatRelativeTimeOptions>,\n): string {\n const unwrappedValue = unwrap(value);\n if (\n unwrappedValue === null ||\n unwrappedValue === undefined ||\n isNaN(unwrappedValue)\n )\n return '';\n\n const unwrappedUnit = unwrap(unit);\n if (!unwrappedUnit) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.style ?? 'long',\n unwrappedOpt?.numeric ?? 'always',\n ).format(unwrappedValue, unwrappedUnit);\n}\n","import { inject, untracked } from '@angular/core';\nimport { type ActivatedRouteSnapshot, Router } from '@angular/router';\nimport { injectIntlConfig, TranslationStore } from './translation-store';\n\nexport function injectResolveParamLocale(snapshot: ActivatedRouteSnapshot) {\n let locale: string | null = null;\n\n const paramName = injectIntlConfig()?.localeParamName;\n\n const routerConfig = inject(Router)['options'];\n\n const alwaysInheritParams =\n typeof routerConfig === 'object' &&\n !!routerConfig &&\n routerConfig.paramsInheritanceStrategy === 'always';\n\n if (paramName) {\n locale = snapshot.paramMap.get(paramName);\n\n if (!locale && !alwaysInheritParams) {\n let currentRoute: ActivatedRouteSnapshot | null = snapshot;\n while (currentRoute && !locale) {\n locale = currentRoute.paramMap.get('locale');\n currentRoute = currentRoute.parent;\n }\n }\n }\n\n if (!locale) {\n locale = untracked(inject(TranslationStore).locale);\n }\n\n return locale;\n}\n","import {\n computed,\n inject,\n isDevMode,\n isSignal,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { type ResolveFn } from '@angular/router';\nimport {\n compileTranslation,\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n type inferCompiledTranslationNamespace,\n} from './compile';\nimport { replaceWithDelim } from './delim';\nimport { injectResolveParamLocale } from './resovler-locale';\nimport {\n type AnyStringRecord,\n type UnknownStringKeyObject,\n} from './string-key-object.type';\nimport {\n injectDefaultLocale,\n injectIntlConfig,\n TranslationStore,\n} from './translation-store';\n\nfunction createEqualsRecord<T extends AnyStringRecord>(keys: (keyof T)[] = []) {\n let keyMatcher: (a: T, b: T) => boolean;\n\n if (keys.length === 0) {\n keyMatcher = () => true;\n } else if (keys.length === 1) {\n const key = keys[0];\n keyMatcher = (a, b) => a[key] === b[key];\n } else {\n keyMatcher = (a, b) => {\n return keys.every((k) => a[k] === b[k]);\n };\n }\n\n return (a?: T, b?: T): boolean => {\n if (!a && !b) return true;\n if (!a || !b) return false;\n return keyMatcher(a, b);\n };\n}\n\ntype TFunction<TMap extends AnyStringRecord> = <\n TKey extends keyof TMap & string,\n>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [TMap[TKey]]\n) => string;\n\ntype SignalTFunction<TMap extends AnyStringRecord> = <\n TKey extends keyof TMap & string,\n>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [() => TMap[TKey]]\n) => Signal<string>;\n\ntype TFunctionWithSignalConstructor<\n TMap extends AnyStringRecord,\n TFN extends TFunction<TMap>,\n> = TFN & {\n asSignal: SignalTFunction<TMap>;\n};\n\nfunction addSignalFn<TMap extends AnyStringRecord, TFn extends TFunction<TMap>>(\n fn: TFn,\n store: TranslationStore,\n keyMap: Map<string, string>,\n): TFunctionWithSignalConstructor<TMap, TFn> {\n const withSig = fn as TFunctionWithSignalConstructor<TMap, TFn>;\n\n const asSignal = <TKey extends keyof TMap & string>(\n key: TKey,\n variables?: () => AnyStringRecord,\n ): Signal<string> => {\n const stringKey = key as string;\n\n let flatPath = keyMap.get(stringKey);\n\n if (flatPath === undefined) {\n flatPath = replaceWithDelim(stringKey);\n keyMap.set(stringKey, flatPath);\n }\n\n const varsFn = variables ?? (() => undefined);\n const varsSignal = isSignal(varsFn)\n ? varsFn\n : computed(varsFn, {\n equal: createEqualsRecord(Object.keys(varsFn() ?? {})),\n });\n\n return computed(() => store.formatMessage(flatPath, varsSignal()));\n };\n\n withSig.asSignal = asSignal as unknown as TFunctionWithSignalConstructor<\n TMap,\n TFn\n >['asSignal'];\n\n return withSig;\n}\n\nexport function createT<TMap extends AnyStringRecord>(\n store: TranslationStore,\n keyMap = new Map<string, string>(),\n): TFunction<TMap> {\n const fn = <TKey extends keyof TMap & string>(\n key: TKey,\n variables?: AnyStringRecord,\n ): string => {\n const stringKey = key as string;\n\n let k = keyMap.get(stringKey);\n\n if (k === undefined) {\n k = replaceWithDelim(stringKey);\n keyMap.set(stringKey, k);\n }\n\n return store.formatMessage(k, variables);\n };\n\n return fn as unknown as TFunction<TMap>;\n}\n\nexport function registerNamespace<\n TDefault extends CompiledTranslation<UnknownStringKeyObject, string>,\n>(\n defaultTranslation: () => Promise<TDefault>,\n other: Record<\n string,\n () => Promise<\n CompiledTranslation<\n UnknownStringKeyObject,\n inferCompiledTranslationNamespace<TDefault>,\n string\n >\n >\n >,\n) {\n type $Map = inferCompiledTranslationMap<TDefault>;\n type $BaseTFN = TFunction<$Map>;\n type $TFN = TFunctionWithSignalConstructor<$Map, $BaseTFN>;\n\n const keyMap = new Map<string, string>();\n\n const injectT = (): $TFN => {\n const store = inject(TranslationStore);\n\n return addSignalFn(createT(store, keyMap), store, keyMap);\n };\n\n let defaultTranslationLoaded = false;\n const resolver: ResolveFn<void> = async (snapshot) => {\n const store = inject(TranslationStore);\n\n const locale = injectResolveParamLocale(snapshot);\n\n const defaultLocale = injectDefaultLocale();\n const shouldPreloadDefault =\n injectIntlConfig()?.preloadDefaultLocale ?? false;\n\n const tPromise = other[locale] as (typeof other)[string] | undefined;\n\n const promise = tPromise ?? defaultTranslation;\n if (!promise && isDevMode()) {\n return console.warn(`No translation found for locale: ${locale}`);\n }\n\n if (promise === defaultTranslation && defaultTranslationLoaded) return;\n\n try {\n const promises = [promise()];\n\n if (\n shouldPreloadDefault &&\n !defaultTranslationLoaded &&\n promise !== defaultTranslation\n )\n promises.push(defaultTranslation());\n\n const translations = await Promise.allSettled(promises);\n\n const fullfilled = translations.map((t) =>\n t.status === 'fulfilled' ? t.value : null,\n );\n\n if (fullfilled.at(0) === null && fullfilled.at(1) === null)\n throw new Error('Failed to load translations');\n\n const [t, defaultT] = fullfilled;\n\n const ns = t?.namespace ?? defaultT?.namespace;\n if (!ns) throw new Error('No namespace found in translation');\n\n if (isDevMode() && t && t.locale !== locale && t.locale)\n console.warn(`Expected locale to be ${locale} but got ${t.locale}`);\n\n store.registerOnDemandLoaders(ns, {\n ...other,\n [defaultLocale]: defaultTranslation,\n });\n\n const toRegister: Record<string, Record<string, string>> = {};\n if (t) toRegister[locale] = t.flat;\n if (defaultT) toRegister[defaultLocale] = defaultT.flat;\n\n store.register(ns, toRegister);\n\n if (promise === defaultTranslation || defaultT)\n defaultTranslationLoaded = true;\n } catch {\n if (isDevMode()) {\n console.warn(`Failed to load translation for locale: ${locale}`);\n }\n } finally {\n if (locale !== untracked(store.locale)) store.locale.set(locale);\n }\n };\n\n return {\n injectNamespaceT: injectT,\n resolveNamespaceTranslation: resolver,\n };\n}\n\ntype UntypedTFunction<TNS extends string> = {\n (key: `${TNS}.${string}`, args?: Record<string, string>): string;\n asSignal: (\n key: `${TNS}.${string}`,\n args?: () => Record<string, string>,\n ) => Signal<string>;\n};\n\n/**\n * Registers a type-unsafe namespace, meant for remote loading of unknown key-value pairs using mmstack/translate infrastructure\n * The resolver & t function work the same as they would with typed namespaces, but without type safety\n */\nexport function registerRemoteNamespace<TNS extends string>(\n ns: TNS,\n defaultTranslation: () => Promise<Record<string, string>>,\n other: Record<string, () => Promise<Record<string, string>>>,\n) {\n const keyMap = new Map<string, string>();\n\n const injectT = (): UntypedTFunction<TNS> => {\n const store = inject(TranslationStore);\n\n return addSignalFn(\n createT(store, keyMap),\n store,\n keyMap,\n ) as UntypedTFunction<TNS>;\n };\n\n let defaultTranslationLoaded = false;\n const resolver: ResolveFn<void> = async (snapshot) => {\n const store = inject(TranslationStore);\n\n const locale = injectResolveParamLocale(snapshot);\n\n const defaultLocale = injectDefaultLocale();\n const shouldPreloadDefault =\n injectIntlConfig()?.preloadDefaultLocale ?? false;\n\n const tPromise = other[locale] as (typeof other)[string] | undefined;\n\n const promise = tPromise ?? defaultTranslation;\n\n if (!promise && isDevMode()) {\n return console.warn(`No translation found for locale: ${locale}`);\n }\n\n if (promise === defaultTranslation && defaultTranslationLoaded) return;\n\n try {\n const promises = [promise()];\n\n if (\n shouldPreloadDefault &&\n !defaultTranslationLoaded &&\n promise !== defaultTranslation\n )\n promises.push(defaultTranslation());\n\n const translations = await Promise.allSettled(promises);\n\n const fullfilled = translations.map((t) =>\n t.status === 'fulfilled' ? t.value : null,\n );\n\n if (fullfilled.at(0) === null && fullfilled.at(1) === null)\n throw new Error('Failed to load translations');\n\n const [baseT, baseDefaultT] = fullfilled;\n\n const t = baseT ? compileTranslation(baseT, ns, locale) : null;\n const defaultT = baseDefaultT\n ? compileTranslation(baseDefaultT, ns, defaultLocale)\n : null;\n\n if (isDevMode() && t && t.locale !== locale && t.locale)\n console.warn(`Expected locale to be ${locale} but got ${t.locale}`);\n\n store.registerOnDemandLoaders(ns, {\n ...other,\n [defaultLocale]: defaultTranslation,\n });\n\n const toRegister: Record<string, Record<string, string>> = {};\n if (t) toRegister[locale] = t.flat;\n if (defaultT) toRegister[defaultLocale] = defaultT.flat;\n\n store.register(ns, toRegister);\n\n if (promise === defaultTranslation || defaultT)\n defaultTranslationLoaded = true;\n } catch {\n if (isDevMode()) {\n console.warn(`Failed to load translation for locale: ${locale}`);\n }\n } finally {\n if (locale !== untracked(store.locale)) store.locale.set(locale);\n }\n };\n\n return {\n injectNamespaceT: injectT,\n resolveNamespaceTranslation: resolver,\n };\n}\n","import { inject } from '@angular/core';\nimport {\n Router,\n type CanMatchFn,\n type Route,\n type UrlSegment,\n} from '@angular/router';\nimport {\n injectDefaultLocale,\n injectSupportedLocales,\n} from './translation-store';\n\n/**\n * Guard that validates the locale parameter against supported locales.\n * Redirects to default locale if the locale is invalid.\n *\n * @param prefixSegments Optional array of path segments preceding the locale segment.\n * if (you wanted to match /app/:locale/... you would pass ['app'] here) & the function would match the second parameter + redirect accordingly\n *\n * @example\n * ```typescript\n * {\n * path: ':locale',\n * canMatch: [canMatchLocale()],\n * children: [...]\n * }\n * ```\n */\nexport function canMatchLocale(prefixSegments: string[] = []): CanMatchFn {\n return (_route: Route, segments: UrlSegment[]) => {\n const supportedLocales = injectSupportedLocales();\n\n const locale = segments.at(prefixSegments.length)?.path;\n\n if (!locale || !supportedLocales.includes(locale))\n return inject(Router).createUrlTree([\n ...prefixSegments,\n injectDefaultLocale(),\n ]);\n\n return true;\n };\n}\n","import {\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n Renderer2,\n} from '@angular/core';\nimport {\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n} from './compile';\nimport { createT } from './register-namespace';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport { TranslationStore } from './translation-store';\n\nfunction compareObjects(\n a?: Record<string, string>,\n b?: Record<string, string>,\n): boolean {\n if (!a && !b) return true;\n if (!a || !b) return false;\n\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n if (aKeys.length !== bKeys.length) return false;\n\n return aKeys.every((key) => a[key] === b[key]);\n}\n\n@Directive()\nexport abstract class Translate<\n TInput extends string,\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>,\n TKey extends TInput & keyof TMap & string = TInput & keyof TMap & string,\n> {\n private readonly t = createT(inject(TranslationStore));\n\n readonly translate =\n input.required<\n TMap[TKey] extends void\n ? TKey | [key: TKey]\n : [key: TKey, vars: TMap[TKey]]\n >();\n\n constructor() {\n const inputs = computed(() => this.translate(), {\n equal: (a, b) => {\n if (a === b) return true;\n if (typeof a === 'string' || typeof b === 'string') return false;\n if (a[0] !== b[0]) return false;\n return compareObjects(\n a[1] as Record<string, string>,\n b[1] as Record<string, string>,\n );\n },\n });\n\n const translation = computed(() => {\n const inp = inputs();\n return typeof inp === 'string'\n ? this.t(inp)\n : this.t(inp[0], inp[1] as Record<string, string>);\n });\n\n const renderer = inject(Renderer2);\n const el = inject<ElementRef<HTMLElement>>(ElementRef);\n\n afterRenderEffect({\n write: () => {\n renderer.setProperty(el.nativeElement, 'textContent', translation());\n },\n });\n }\n}\n","import { ChangeDetectorRef, effect, inject } from '@angular/core';\nimport {\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n} from './compile';\nimport { createT } from './register-namespace';\nimport {\n type AnyStringRecord,\n type UnknownStringKeyObject,\n} from './string-key-object.type';\nimport { TranslationStore } from './translation-store';\n\ntype TransformTFn<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T>,\n> = <TKey extends keyof TMap & string>(\n key: TKey,\n ...args: TMap[TKey] extends void\n ? [locale?: string]\n : [TMap[TKey], locale?: string]\n) => string;\n\nfunction createTransformFn<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T>,\n>(): TransformTFn<T, TMap> {\n const store = inject(TranslationStore);\n const t = createT<TMap>(store);\n\n const fn = <TKey extends keyof TMap & string>(\n key: TKey,\n variablesOrLocale?: string | AnyStringRecord,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _?: string, // maybeLocale\n ): string => {\n const vars =\n typeof variablesOrLocale === 'string' ? undefined : variablesOrLocale;\n\n return (t as (key: TKey, vars?: AnyStringRecord) => string)(key, vars);\n };\n\n return fn as unknown as TransformTFn<T, TMap>;\n}\n\nexport abstract class Translator<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>,\n> {\n constructor() {\n const cdr = inject(ChangeDetectorRef);\n const locale = inject(TranslationStore).locale;\n\n effect(() => {\n locale();\n cdr.markForCheck();\n });\n }\n\n transform = createTransformFn<T, TMap>();\n}\n","import { type Provider, signal } from '@angular/core';\nimport { createIntl, createIntlCache, type IntlShape } from '@formatjs/intl';\nimport { compileTranslation } from '../compile';\nimport { type UnknownStringKeyObject } from '../string-key-object.type';\nimport { TranslationStore } from '../translation-store';\n\n/**\n * Options designed to feed into the mock translations function.\n */\nexport interface MockTranslationOptions {\n /**\n * If provided, allows overriding the default behavior of simply echoing translation keys back.\n * Format: Record of namespace -> (Translation shape similar to what you pass to `createNamespace`)\n *\n * Example:\n * ```ts\n * {\n * home: { title: 'Mocked Title' },\n * auth: { error: 'Mocked Error' }\n * }\n * ```\n */\n translations?: Record<string, UnknownStringKeyObject>;\n\n /**\n * When true, uses `@formatjs/intl` to process ICU message syntax (e.g. `{name}`, plurals, selects).\n * This gives you real variable interpolation in your test assertions.\n *\n * @default false β€” values are ignored and the raw message string is returned.\n *\n * @example\n * ```ts\n * provideMockTranslations({\n * translations: { home: { greet: 'Hello {name}' } },\n * formatValues: true,\n * })\n * // t('home.greet', { name: 'Alice' }) β†’ 'Hello Alice'\n * ```\n */\n formatValues?: boolean;\n\n /**\n * The locale to use when `formatValues` is true.\n * @default 'en-US'\n */\n locale?: string;\n}\n\n/**\n * Provides an isolated mock `TranslationStore` usable across testing modules that use components\n * depending on `@mmstack/translate` APIs (like `Translate` directive, `Translator` pipe, or `injectNamespaceT`).\n *\n * This provider intercepts all translation logic, bypassing chunk loaders and Intl.\n * When a custom configuration isn't provided, formatMessage simply echoes the translation key, using dots `.`.\n *\n * ### Usage\n * ```typescript\n * TestBed.configureTestingModule({\n * providers: [provideMockTranslations()]\n * });\n * ```\n */\nexport function provideMockTranslations(\n options?: MockTranslationOptions,\n): Provider[] {\n // We compile the mock strings to flat delimiters just like the internal compile module.\n const mappedMocks: Record<string, string> = {};\n\n if (options?.translations) {\n for (const [namespace, translationObj] of Object.entries(\n options.translations,\n )) {\n const compiled = compileTranslation(translationObj, namespace);\n\n for (const [key, val] of Object.entries(compiled.flat)) {\n // e.g. from 'home::MMT_DELIM::title'\n const fullKey = `${namespace}::MMT_DELIM::${key}`;\n mappedMocks[fullKey] = val;\n }\n }\n }\n\n const locale = options?.locale ?? 'en-US';\n\n let intl: IntlShape | undefined;\n\n if (options?.formatValues) {\n intl = createIntl({ locale, messages: mappedMocks }, createIntlCache());\n }\n\n return [\n {\n provide: TranslationStore,\n useValue: {\n locale: signal(locale),\n formatMessage: (\n key: string,\n values?: Record<string, string | number>,\n ) => {\n const message = mappedMocks[key];\n\n if (!message) {\n // Fallback to echoing the key back in dot notation (more readable for unit assertions).\n return key.replaceAll('::MMT_DELIM::', '.');\n }\n\n if (intl) {\n return intl.formatMessage(\n { id: key, defaultMessage: message },\n values,\n );\n }\n\n return message;\n },\n hasLocaleLoaders: () => false,\n register: () => {\n // noop\n },\n registerOnDemandLoaders: () => {\n // noop\n },\n dynamicLocaleLoader: {\n isLoading: signal(false),\n value: signal(null),\n error: signal(null),\n },\n loadQueue: signal([]),\n },\n },\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["cache","getFormatter"],"mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,eAAe;AAE3B,SAAU,YAAY,CAAC,MAAc,EAAE,GAAW,EAAA;AACtD,IAAA,OAAO,GAAG,MAAM,CAAA,EAAG,SAAS,CAAA,EAAG,GAAG,EAAE;AACtC;SAEgB,gBAAgB,CAAC,GAAW,EAAE,IAAI,GAAG,GAAG,EAAA;IACtD,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC;AACxC;;ACDA,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAyChE,SAAS,mBAAmB,CAAC,CAAU,EAAA;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;AAC5C;AAEA,SAAS,kBAAkB,CAAmC,G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
2
2
  "name": "@mmstack/translate",
3
- "version": "21.1.8",
3
+ "version": "21.1.9",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "localize",
@@ -11,7 +11,8 @@
11
11
  "license": "MIT",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/mihajm/mmstack"
14
+ "url": "git+https://github.com/mihajm/mmstack.git",
15
+ "directory": "packages/translate"
15
16
  },
16
17
  "peerDependencies": {
17
18
  "@angular/core": ">=21 <22",
@@ -31,6 +32,7 @@
31
32
  "default": "./fesm2022/mmstack-translate.mjs"
32
33
  }
33
34
  },
35
+ "type": "module",
34
36
  "dependencies": {
35
37
  "tslib": "^2.3.0"
36
38
  }
@@ -5,6 +5,7 @@ import * as _formatjs_intl from '@formatjs/intl';
5
5
  import { IntlConfig } from '@formatjs/intl';
6
6
 
7
7
  type UnknownStringKeyObject = Record<string, unknown>;
8
+ type AnyStringRecord = Record<string, any>;
8
9
 
9
10
  type Simplify<T> = T extends infer U ? {
10
11
  [K in keyof U]: Simplify<U[K]>;
@@ -309,7 +310,6 @@ declare function injectDynamicLocale(): WritableSignal<string> & {
309
310
  isLoading: Signal<boolean>;
310
311
  };
311
312
 
312
- type AnyStringRecord = Record<string, any>;
313
313
  type TFunction<TMap extends AnyStringRecord> = <TKey extends keyof TMap & string>(key: TKey, ...args: TMap[TKey] extends void ? [] : [TMap[TKey]]) => string;
314
314
  type SignalTFunction<TMap extends AnyStringRecord> = <TKey extends keyof TMap & string>(key: TKey, ...args: TMap[TKey] extends void ? [] : [() => TMap[TKey]]) => Signal<string>;
315
315
  type TFunctionWithSignalConstructor<TMap extends AnyStringRecord, TFN extends TFunction<TMap>> = TFN & {
@@ -360,11 +360,10 @@ declare abstract class Translate<TInput extends string, T extends CompiledTransl
360
360
  static Ι΅dir: i0.Ι΅Ι΅DirectiveDeclaration<Translate<any, any, any, any>, never, never, { "translate": { "alias": "translate"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
361
361
  }
362
362
 
363
+ type TransformTFn<T extends CompiledTranslation<UnknownStringKeyObject, string>, TMap extends inferCompiledTranslationMap<T>> = <TKey extends keyof TMap & string>(key: TKey, ...args: TMap[TKey] extends void ? [locale?: string] : [TMap[TKey], locale?: string]) => string;
363
364
  declare abstract class Translator<T extends CompiledTranslation<UnknownStringKeyObject, string>, TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>> {
364
- private readonly store;
365
- private readonly t;
366
365
  constructor();
367
- transform<K extends keyof TMap & string>(key: K, ...args: TMap[K] extends void ? [locale?: string] : [TMap[K], locale?: string]): string;
366
+ transform: TransformTFn<T, TMap>;
368
367
  }
369
368
 
370
369
  /**