@mmstack/translate 21.1.3 → 21.1.5

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
@@ -516,6 +516,62 @@ When switching locales dynamically, the library:
516
516
  3. Updates all reactive outputs automatically
517
517
  4. Falls back to the default locale if unavailable
518
518
 
519
+ ## Remote / Unsafe Namespaces
520
+
521
+ For cases where you need to load translations from a remote API (where keys aren't known at compile-time), use `registerRemoteNamespace`. This provides an untyped experience but allows you to integrate dynamic content into the same system.
522
+
523
+ ```typescript
524
+ import { registerRemoteNamespace } from '@mmstack/translate';
525
+
526
+ // Returns an untyped t function: t('any.key')
527
+ const { injectNamespaceT: injectRemoteT } = registerRemoteNamespace('remote', () => fetch('/api/en').then((r) => r.json()), {
528
+ 'sl-SI': () => fetch('/api/sl').then((r) => r.json()),
529
+ });
530
+
531
+ // usage
532
+ const t = injectRemoteT();
533
+
534
+ // .asSignal variants also work
535
+ const value = t('remote.myKey');
536
+ const valueThatNeedsProps = t('remote.myOtherKey', {
537
+ name: 'John',
538
+ });
539
+ ```
540
+
541
+ ## Formatters
542
+
543
+ The library includes a set of reactive formatters that automatically adapt to the current locale. They are standalone functions that do not require dependency injection, making them easy to use anywhere.
544
+
545
+ **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
+
547
+ Available formatters:
548
+
549
+ - **`formatDate`**: Wraps `Intl.DateTimeFormat`
550
+ - **`formatNumber`**: Wraps `Intl.NumberFormat`
551
+ - **`formatCurrency`**: Wraps `Intl.NumberFormat` (currency style)
552
+ - **`formatPercent`**: Wraps `Intl.NumberFormat` (percent style)
553
+ - **`formatList`**: Wraps `Intl.ListFormat`
554
+ - **`formatRelativeTime`**: Wraps `Intl.RelativeTimeFormat`
555
+ - **`formatDisplayName`**: Wraps `Intl.DisplayNames`
556
+
557
+ **Example:**
558
+
559
+ ```typescript
560
+ import { computed, signal } from '@angular/core';
561
+ import { formatCurrency, formatDate } from '@mmstack/translate';
562
+
563
+ export class MyComponent {
564
+ readonly price = signal(1234.56);
565
+ readonly date = new Date();
566
+
567
+ // Reacts to price changes OR locale changes
568
+ readonly displayPrice = computed(() => formatCurrency(this.price(), 'EUR'));
569
+
570
+ // Reacts to locale changes
571
+ readonly displayDate = computed(() => formatDate(this.date));
572
+ }
573
+ ```
574
+
519
575
  ## Migration from Other Libraries
520
576
 
521
577
  ### From @angular/localize
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, computed, InjectionToken, LOCALE_ID, signal, resource, untracked, isDevMode, effect, Injectable, isSignal, input, Renderer2, ElementRef, afterRenderEffect, Directive, ChangeDetectorRef } from '@angular/core';
3
- import { Router, ActivatedRoute } from '@angular/router';
4
3
  import { createIntlCache, createIntl } from '@formatjs/intl';
5
4
  import { toSignal } from '@angular/core/rxjs-interop';
5
+ import { Router, ActivatedRoute } from '@angular/router';
6
6
 
7
7
  const KEY_DELIM = '::MMT_DELIM::';
8
8
  function prependDelim(prefix, key) {
@@ -127,11 +127,19 @@ function injectDefaultLocale() {
127
127
  function injectSupportedLocales() {
128
128
  return injectIntlConfig()?.supportedLocales ?? [injectDefaultLocale()];
129
129
  }
130
+ /**
131
+ * @internal
132
+ * the actual locale signal used to store the current locale string
133
+ */
134
+ const STORE_LOCALE = signal('en-US', ...(ngDevMode ? [{ debugName: "STORE_LOCALE" }] : []));
135
+ function injectLocaleInternal() {
136
+ return STORE_LOCALE;
137
+ }
130
138
  class TranslationStore {
131
139
  cache = createIntlCache();
132
140
  config = injectIntlConfig();
133
141
  loadQueue = signal([], ...(ngDevMode ? [{ debugName: "loadQueue" }] : []));
134
- locale = signal(injectDefaultLocale(), ...(ngDevMode ? [{ debugName: "locale" }] : []));
142
+ locale;
135
143
  defaultLocale = injectDefaultLocale();
136
144
  translations = signal({
137
145
  [this.defaultLocale]: {},
@@ -187,6 +195,8 @@ class TranslationStore {
187
195
  messages: this.messages(),
188
196
  }, this.cache), ...(ngDevMode ? [{ debugName: "intl" }] : []));
189
197
  constructor() {
198
+ this.locale = STORE_LOCALE;
199
+ this.locale.set(injectDefaultLocale());
190
200
  const paramName = this.config?.localeParamName;
191
201
  if (paramName) {
192
202
  const param = pathParam(paramName);
@@ -324,6 +334,220 @@ function injectDynamicLocale() {
324
334
  return source;
325
335
  }
326
336
 
337
+ function unwrap(value) {
338
+ return isSignal(value) ? value() : value;
339
+ }
340
+
341
+ const FORMAT_PRESETS = {
342
+ short: { dateStyle: 'short', timeStyle: 'short' },
343
+ medium: { dateStyle: 'medium', timeStyle: 'medium' },
344
+ long: { dateStyle: 'long', timeStyle: 'long' },
345
+ full: { dateStyle: 'full', timeStyle: 'full' },
346
+ shortDate: { dateStyle: 'short' },
347
+ mediumDate: { dateStyle: 'medium' },
348
+ longDate: { dateStyle: 'long' },
349
+ fullDate: { dateStyle: 'full' },
350
+ shortTime: { timeStyle: 'short' },
351
+ mediumTime: { timeStyle: 'medium' },
352
+ longTime: { timeStyle: 'long' },
353
+ fullTime: { timeStyle: 'full' },
354
+ };
355
+ function validDateOrNull(date) {
356
+ if (date == null)
357
+ return null;
358
+ const d = date instanceof Date ? date : new Date(date);
359
+ return isNaN(d.getTime()) ? null : d;
360
+ }
361
+ const cache$4 = new Map();
362
+ function getFormatter$4(locale, format, timeZone) {
363
+ const cacheKey = `${locale}|${format}|${timeZone ?? ''}`;
364
+ let formatter = cache$4.get(cacheKey);
365
+ if (!formatter) {
366
+ formatter = new Intl.DateTimeFormat(locale, {
367
+ ...FORMAT_PRESETS[format],
368
+ timeZone,
369
+ });
370
+ cache$4.set(cacheKey, formatter);
371
+ }
372
+ return formatter;
373
+ }
374
+ /**
375
+ * Format a date using the current or provided locale & timezone
376
+ * 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
377
+ *
378
+ * @param date - Date to format
379
+ * @param opt - Options for formatting
380
+ * @returns Formatted date string
381
+ */
382
+ function formatDate(date, opt) {
383
+ const validDate = validDateOrNull(unwrap(date));
384
+ if (validDate === null)
385
+ return '';
386
+ const unwrappedOpt = unwrap(opt);
387
+ const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
388
+ return getFormatter$4(loc, unwrappedOpt?.format ?? 'medium', unwrappedOpt?.tz).format(validDate);
389
+ }
390
+
391
+ const cache$3 = new Map();
392
+ function getFormatter$3(locale, type, style) {
393
+ const cacheKey = `${locale}|${type}|${style}`;
394
+ let formatter = cache$3.get(cacheKey);
395
+ if (!formatter) {
396
+ formatter = new Intl.DisplayNames(locale, {
397
+ type,
398
+ style,
399
+ });
400
+ cache$3.set(cacheKey, formatter);
401
+ }
402
+ return formatter;
403
+ }
404
+ /**
405
+ * Format a display name using the current or provided locale
406
+ * 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
407
+ *
408
+ * @param value - The code to format
409
+ * @param type - The type of display name to format
410
+ * @param opt - Options for formatting
411
+ * @returns Formatted display name string
412
+ */
413
+ function formatDisplayName(value, type, opt) {
414
+ const unwrapped = unwrap(value);
415
+ if (!unwrapped?.trim())
416
+ return '';
417
+ const unwrappedType = unwrap(type);
418
+ const unwrappedOpt = unwrap(opt);
419
+ const locale = unwrappedOpt?.locale ?? injectLocaleInternal()();
420
+ return (getFormatter$3(locale, unwrappedType, unwrappedOpt?.style ?? 'long').of(unwrapped) ?? '');
421
+ }
422
+
423
+ const cache$2 = new Map();
424
+ const EMPTY_ARRAY = [];
425
+ function unwrapList(value) {
426
+ const unwrapped = unwrap(value);
427
+ return Array.isArray(unwrapped) ? unwrapped : EMPTY_ARRAY;
428
+ }
429
+ function getFormatter$2(locale, type, style) {
430
+ const cacheKey = `${locale}|${type}|${style}`;
431
+ let formatter = cache$2.get(cacheKey);
432
+ if (!formatter) {
433
+ formatter = new Intl.ListFormat(locale, { type, style });
434
+ cache$2.set(cacheKey, formatter);
435
+ }
436
+ return formatter;
437
+ }
438
+ /**
439
+ * Format a list using the current or provided locale
440
+ * 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
441
+ *
442
+ * @param value - The list to format
443
+ * @param opt - Options for formatting
444
+ * @returns Formatted list string
445
+ */
446
+ function formatList(value, opt) {
447
+ const unwrapped = unwrapList(value);
448
+ if (unwrapped.length === 0)
449
+ return '';
450
+ const unwrappedOpt = unwrap(opt);
451
+ const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
452
+ return getFormatter$2(loc, unwrappedOpt?.type ?? 'conjunction', unwrappedOpt?.style ?? 'long').format(unwrapped);
453
+ }
454
+
455
+ const cache$1 = new Map();
456
+ function unwrapValue(value, fallbackToZero = false) {
457
+ const unwrapped = unwrap(value);
458
+ if (unwrapped === null || unwrapped === undefined || isNaN(unwrapped))
459
+ return fallbackToZero ? 0 : null;
460
+ return unwrapped;
461
+ }
462
+ function getFormatter$1(locale, minFractionDigits, maxFractionDigits, useGrouping, notation, currency, display, style) {
463
+ const cacheKey = `${locale}|${notation ?? 'standard'}|${minFractionDigits}|${maxFractionDigits}|${useGrouping ?? true}|${currency ?? 'none'}|${display ?? 'none'}|${style ?? 'decimal'}`;
464
+ let formatter = cache$1.get(cacheKey);
465
+ if (!formatter) {
466
+ formatter = new Intl.NumberFormat(locale, {
467
+ style,
468
+ notation,
469
+ minimumFractionDigits: minFractionDigits,
470
+ maximumFractionDigits: maxFractionDigits,
471
+ useGrouping,
472
+ });
473
+ cache$1.set(cacheKey, formatter);
474
+ }
475
+ return formatter;
476
+ }
477
+ /**
478
+ * Format a number using the current or provided locale
479
+ * 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
480
+ *
481
+ * @param number - Number to format
482
+ * @param opt - Options for formatting
483
+ * @returns Formatted number string
484
+ */
485
+ function formatNumber(value, opt) {
486
+ const unwrappedOpt = unwrap(opt);
487
+ const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);
488
+ if (unwrappedNumber === null)
489
+ return '';
490
+ const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
491
+ return getFormatter$1(loc, unwrappedOpt?.minFractionDigits ?? 0, unwrappedOpt?.maxFractionDigits ?? 0, unwrappedOpt?.useGrouping ?? true, unwrappedOpt?.notation ?? 'standard').format(unwrappedNumber);
492
+ }
493
+ /**
494
+ * Format a percentage using the current or provided locale
495
+ * 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
496
+ *
497
+ * @param number - Number to format
498
+ * @param opt - Options for formatting
499
+ * @returns Formatted percentage string
500
+ */
501
+ function formatPercent(value, opt) {
502
+ const unwrappedOpt = unwrap(opt);
503
+ let unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);
504
+ if (unwrappedNumber === null)
505
+ return '';
506
+ const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
507
+ return getFormatter$1(loc, unwrappedOpt?.minFractionDigits ?? 0, unwrappedOpt?.maxFractionDigits ?? 0, undefined, undefined, undefined, undefined, 'percent').format(unwrappedNumber);
508
+ }
509
+ function formatCurrency(value, currency, opt) {
510
+ const unwrappedOpt = unwrap(opt);
511
+ const unwrappedValue = unwrapValue(value, unwrappedOpt?.fallbackToZero);
512
+ if (unwrappedValue === null)
513
+ return '';
514
+ const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
515
+ return getFormatter$1(loc, 0, 0, undefined, undefined, unwrap(currency), unwrappedOpt?.display ?? 'symbol', 'currency').format(unwrappedValue);
516
+ }
517
+
518
+ const cache = new Map();
519
+ function getFormatter(locale, style, numeric) {
520
+ const cacheKey = `${locale}|${style}|${numeric}`;
521
+ let formatter = cache.get(cacheKey);
522
+ if (!formatter) {
523
+ formatter = new Intl.RelativeTimeFormat(locale, { style, numeric });
524
+ cache.set(cacheKey, formatter);
525
+ }
526
+ return formatter;
527
+ }
528
+ /**
529
+ * Format a relative time using the current or provided locale
530
+ * 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
531
+ *
532
+ * @param value - The numeric value to use in the relative time internationalization message
533
+ * @param unit - The unit to use in the relative time internationalization message
534
+ * @param opt - Options for formatting
535
+ * @returns Formatted relative time string
536
+ */
537
+ function formatRelativeTime(value, unit, opt) {
538
+ const unwrappedValue = unwrap(value);
539
+ if (unwrappedValue === null ||
540
+ unwrappedValue === undefined ||
541
+ isNaN(unwrappedValue))
542
+ return '';
543
+ const unwrappedUnit = unwrap(unit);
544
+ if (!unwrappedUnit)
545
+ return '';
546
+ const unwrappedOpt = unwrap(opt);
547
+ const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
548
+ return getFormatter(loc, unwrappedOpt?.style ?? 'long', unwrappedOpt?.numeric ?? 'always').format(unwrappedValue, unwrappedUnit);
549
+ }
550
+
327
551
  function injectResolveParamLocale(snapshot) {
328
552
  let locale = null;
329
553
  const paramName = injectIntlConfig()?.localeParamName;
@@ -455,6 +679,73 @@ function registerNamespace(defaultTranslation, other) {
455
679
  resolveNamespaceTranslation: resolver,
456
680
  };
457
681
  }
682
+ /**
683
+ * Registers a type-unsafe namespace, meant for remote loading of unknown key-value pairs using mmstack/translate infrastructure
684
+ * The resolver & t function work the same as they would with typed namespaces, but without type safety
685
+ */
686
+ function registerRemoteNamespace(ns, defaultTranslation, other) {
687
+ const injectT = () => {
688
+ const store = inject(TranslationStore);
689
+ return addSignalFn(createT(store), store);
690
+ };
691
+ let defaultTranslationLoaded = false;
692
+ const resolver = async (snapshot) => {
693
+ const store = inject(TranslationStore);
694
+ const locale = injectResolveParamLocale(snapshot);
695
+ const defaultLocale = injectDefaultLocale();
696
+ const shouldPreloadDefault = injectIntlConfig()?.preloadDefaultLocale ?? false;
697
+ const tPromise = other[locale];
698
+ const promise = tPromise ?? defaultTranslation;
699
+ if (!promise && isDevMode()) {
700
+ return console.warn(`No translation found for locale: ${locale}`);
701
+ }
702
+ if (promise === defaultTranslation && defaultTranslationLoaded)
703
+ return;
704
+ try {
705
+ const promises = [promise()];
706
+ if (shouldPreloadDefault &&
707
+ !defaultTranslationLoaded &&
708
+ promise !== defaultTranslation)
709
+ promises.push(defaultTranslation());
710
+ const translations = await Promise.allSettled(promises);
711
+ const fullfilled = translations.map((t) => t.status === 'fulfilled' ? t.value : null);
712
+ if (fullfilled.at(0) === null && fullfilled.at(1) === null)
713
+ throw new Error('Failed to load translations');
714
+ const [baseT, baseDefaultT] = fullfilled;
715
+ const t = baseT ? compileTranslation(baseT, ns, locale) : null;
716
+ const defaultT = baseDefaultT
717
+ ? compileTranslation(baseDefaultT, ns, defaultLocale)
718
+ : null;
719
+ if (isDevMode() && t && t.locale !== locale && t.locale)
720
+ console.warn(`Expected locale to be ${locale} but got ${t.locale}`);
721
+ store.registerOnDemandLoaders(ns, {
722
+ ...other,
723
+ [defaultLocale]: defaultTranslation,
724
+ });
725
+ const toRegister = {};
726
+ if (t)
727
+ toRegister[locale] = t.flat;
728
+ if (defaultT)
729
+ toRegister[defaultLocale] = defaultT.flat;
730
+ store.register(ns, toRegister);
731
+ if (promise === defaultTranslation || defaultT)
732
+ defaultTranslationLoaded = true;
733
+ }
734
+ catch {
735
+ if (isDevMode()) {
736
+ console.warn(`Failed to load translation for locale: ${locale}`);
737
+ }
738
+ }
739
+ finally {
740
+ if (locale !== untracked(store.locale))
741
+ store.locale.set(locale);
742
+ }
743
+ };
744
+ return {
745
+ injectNamespaceT: injectT,
746
+ resolveNamespaceTranslation: resolver,
747
+ };
748
+ }
458
749
 
459
750
  /**
460
751
  * Guard that validates the locale parameter against supported locales.
@@ -544,5 +835,5 @@ class Translator {
544
835
  * Generated bundle index. Do not edit.
545
836
  */
546
837
 
547
- export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, registerNamespace };
838
+ export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, registerNamespace, registerRemoteNamespace };
548
839
  //# sourceMappingURL=mmstack-translate.mjs.map
@@ -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/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/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 CompiledTranslation,\n compileTranslation,\n inferCompiledTranslationShape,\n mergeTranslationMaps,\n} from './compile';\nimport { 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: compileTranslation(translation, ns),\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<\n TOther,\n 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@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 = signal(injectDefaultLocale());\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 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 { inject, untracked } from '@angular/core';\nimport { 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 type Signal,\n untracked,\n} from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport {\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// eslint-disable-next-line @typescript-eslint/no-explicit-any\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","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 { CompiledTranslation, inferCompiledTranslationMap } from './compile';\nimport { createT } from './register-namespace';\nimport { 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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"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,gBAAg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,OAAO,CAAC,KAAK,QAAQ,CACY;QAE1C,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;IACnC;AACD;;AClCD;;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/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 CompiledTranslation,\n compileTranslation,\n inferCompiledTranslationShape,\n mergeTranslationMaps,\n} from './compile';\nimport { 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: compileTranslation(translation, ns),\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<\n TOther,\n 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 { 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: boolean = 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,\n maxFractionDigits: number,\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 });\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 ?? 0,\n unwrappedOpt?.maxFractionDigits ?? 0,\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 let 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 ?? 0,\n unwrappedOpt?.maxFractionDigits ?? 0,\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 0,\n 0,\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 { 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 { 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// eslint-disable-next-line @typescript-eslint/no-explicit-any\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 { CompiledTranslation, inferCompiledTranslationMap } from './compile';\nimport { createT } from './register-namespace';\nimport { 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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["cache","getFormatter"],"mappings":";;;;;;AAAA,MA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M,CAAC,iBAAiB,CAAC;QAErC,MAAM,CAAC,MAAK;AACV,YAAA,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACnB,GAAG,CAAC,YAAY,EAAE;AACpB,QAAA,CAAC,CAAC;IACJ;AAEA,IAAA,SAAS,CACP,GAAM,EACN,GAAG,IAE2B,EAAA;AAE9B,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAC5B,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,QAAQ,CACY;QAE1C,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;IACnC;AACD;;AClCD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmstack/translate",
3
- "version": "21.1.3",
3
+ "version": "21.1.5",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "localize",
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { WritableSignal, Signal, Provider } from '@angular/core';
2
+ import { Signal, WritableSignal, Provider } from '@angular/core';
3
3
  import { ResolveFn, ActivatedRouteSnapshot, CanMatchFn } from '@angular/router';
4
4
  import * as _formatjs_intl from '@formatjs/intl';
5
5
  import { IntlConfig } from '@formatjs/intl';
@@ -65,6 +65,217 @@ type TranslationNamespace<TNS extends string, T extends CompiledTranslation<Unkn
65
65
  };
66
66
  declare function createNamespace<const T extends UnknownStringKeyObject, TNS extends string>(ns: TNS, translation: T): TranslationNamespace<TNS, CompiledTranslation<T, TNS, string>, inferTranslationShape<T>>;
67
67
 
68
+ declare const FORMAT_PRESETS: Record<string, Intl.DateTimeFormatOptions>;
69
+ type DateFormat = keyof typeof FORMAT_PRESETS;
70
+ /**
71
+ * Supported date inputs
72
+ */
73
+ type SupportedDateInput = Date | string | number | null | undefined;
74
+ /**
75
+ * Options for formatting a date
76
+ */
77
+ type FormatDateOptions = {
78
+ /**
79
+ * Timezone to use for formatting
80
+ */
81
+ tz?: string;
82
+ /**
83
+ * Format to use for formatting
84
+ * @default 'medium'
85
+ */
86
+ format?: DateFormat;
87
+ /**
88
+ * Locale to use for formatting, opts out to dynamic locale changes
89
+ */
90
+ locale?: string;
91
+ };
92
+ /**
93
+ * Format a date using the current or provided locale & timezone
94
+ * 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
95
+ *
96
+ * @param date - Date to format
97
+ * @param opt - Options for formatting
98
+ * @returns Formatted date string
99
+ */
100
+ declare function formatDate(date: SupportedDateInput | Signal<SupportedDateInput>, opt?: FormatDateOptions | Signal<FormatDateOptions>): string;
101
+
102
+ /**
103
+ * Options for formatting a display name
104
+ */
105
+ type FormatDisplayNameOptions = {
106
+ /**
107
+ * The display style for the result set
108
+ */
109
+ style: Intl.RelativeTimeFormatStyle;
110
+ /**
111
+ * Locale to use for formatting, opts out to dynamic locale changes
112
+ */
113
+ locale?: string;
114
+ };
115
+ type SupportedCode = string | null | undefined;
116
+ /**
117
+ * Format a display name using the current or provided locale
118
+ * 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
119
+ *
120
+ * @param value - The code to format
121
+ * @param type - The type of display name to format
122
+ * @param opt - Options for formatting
123
+ * @returns Formatted display name string
124
+ */
125
+ declare function formatDisplayName(value: SupportedCode | Signal<SupportedCode>, type: Intl.DisplayNamesType | Signal<Intl.DisplayNamesType>, opt?: FormatDisplayNameOptions | Signal<FormatDisplayNameOptions>): string;
126
+
127
+ type ListType = 'conjunction' | 'disjunction' | 'unit';
128
+ type ListStyle = 'long' | 'short' | 'narrow';
129
+ type SupportedListInput = string[] | null | undefined;
130
+ /**
131
+ * Options for formatting a list
132
+ */
133
+ type FormatListOptions = {
134
+ /**
135
+ * The type of list to format
136
+ */
137
+ type?: ListType;
138
+ /**
139
+ * The style of list to format
140
+ */
141
+ style?: ListStyle;
142
+ /**
143
+ * Locale to use for formatting, opts out to dynamic locale changes
144
+ */
145
+ locale?: string;
146
+ };
147
+ /**
148
+ * Format a list using the current or provided locale
149
+ * 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
150
+ *
151
+ * @param value - The list to format
152
+ * @param opt - Options for formatting
153
+ * @returns Formatted list string
154
+ */
155
+ declare function formatList(value: SupportedListInput | Signal<SupportedListInput>, opt?: FormatListOptions | Signal<FormatListOptions>): string;
156
+
157
+ type NumberNotation = 'standard' | 'scientific' | 'engineering' | 'compact';
158
+ type SupportedNumberValue = number | null | undefined;
159
+ /**
160
+ * Options for formatting a number
161
+ */
162
+ type FormatNumberOptions = {
163
+ /**
164
+ * The notation to use for formatting
165
+ */
166
+ notation?: NumberNotation;
167
+ /**
168
+ * Minimum number of fraction digits to use
169
+ */
170
+ minFractionDigits?: number;
171
+ /**
172
+ * Maximum number of fraction digits to use
173
+ */
174
+ maxFractionDigits?: number;
175
+ /**
176
+ * Whether to use grouping
177
+ */
178
+ useGrouping?: boolean;
179
+ /**
180
+ * Locale to use for formatting, opts out to dynamic locale changes
181
+ */
182
+ locale?: string;
183
+ /**
184
+ * If the number is not a valid number, return formatted 0. By default formatter returns an empty string
185
+ * @default false
186
+ */
187
+ fallbackToZero?: boolean;
188
+ };
189
+ /**
190
+ * Format a number using the current or provided locale
191
+ * 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
192
+ *
193
+ * @param number - Number to format
194
+ * @param opt - Options for formatting
195
+ * @returns Formatted number string
196
+ */
197
+ declare function formatNumber(value: SupportedNumberValue | Signal<SupportedNumberValue>, opt?: FormatNumberOptions | Signal<FormatNumberOptions>): string;
198
+ /**
199
+ * Options for formatting a percentage value
200
+ */
201
+ type FormatPercentOptions = {
202
+ /**
203
+ * Minimum number of fraction digits to use
204
+ */
205
+ minFractionDigits?: number;
206
+ /**
207
+ * Maximum number of fraction digits to use
208
+ */
209
+ maxFractionDigits?: number;
210
+ /**
211
+ * Locale to use for formatting, opts out to dynamic locale changes
212
+ */
213
+ locale?: string;
214
+ /**
215
+ * If the number is not a valid number, return formatted 0. By default formatter returns an empty string
216
+ * @default false
217
+ */
218
+ fallbackToZero?: boolean;
219
+ };
220
+ /**
221
+ * Format a percentage using the current or provided locale
222
+ * 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
223
+ *
224
+ * @param number - Number to format
225
+ * @param opt - Options for formatting
226
+ * @returns Formatted percentage string
227
+ */
228
+ declare function formatPercent(value: SupportedNumberValue | Signal<SupportedNumberValue>, opt?: FormatPercentOptions | Signal<FormatPercentOptions>): string;
229
+ type CurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name';
230
+ /**
231
+ * Options for formatting a currency
232
+ */
233
+ type FormatCurrencyOptions = {
234
+ display?: CurrencyDisplay;
235
+ /**
236
+ * Locale to use for formatting, opts out to dynamic locale changes
237
+ */
238
+ locale?: string;
239
+ /**
240
+ * If the number is not a valid number, return formatted 0. By default formatter returns an empty string
241
+ * @default false
242
+ */
243
+ fallbackToZero?: boolean;
244
+ };
245
+ declare function formatCurrency(value: SupportedNumberValue | Signal<SupportedNumberValue>, currency: string | Signal<string>, opt?: FormatCurrencyOptions | Signal<FormatCurrencyOptions>): string;
246
+
247
+ /**
248
+ * Options for formatting a relative time value
249
+ */
250
+ type FormatRelativeTimeOptions = {
251
+ /**
252
+ * The length of the internationalized message.
253
+ * @default 'long'
254
+ */
255
+ style?: Intl.RelativeTimeFormatStyle;
256
+ /**
257
+ * Controls whether to use numeric values in the output.
258
+ * @default 'always'
259
+ */
260
+ numeric?: Intl.RelativeTimeFormatNumeric;
261
+ /**
262
+ * Locale to use for formatting, opts out to dynamic locale changes
263
+ */
264
+ locale?: string;
265
+ };
266
+ type RelativeTimeUnit = Intl.RelativeTimeFormatUnit;
267
+ type SupportedRelativeTimeInput = number | null | undefined;
268
+ /**
269
+ * Format a relative time using the current or provided locale
270
+ * 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
271
+ *
272
+ * @param value - The numeric value to use in the relative time internationalization message
273
+ * @param unit - The unit to use in the relative time internationalization message
274
+ * @param opt - Options for formatting
275
+ * @returns Formatted relative time string
276
+ */
277
+ declare function formatRelativeTime(value: SupportedRelativeTimeInput | Signal<SupportedRelativeTimeInput>, unit: RelativeTimeUnit | Signal<RelativeTimeUnit>, opt?: FormatRelativeTimeOptions | Signal<FormatRelativeTimeOptions>): string;
278
+
68
279
  declare function provideIntlConfig(config: Omit<IntlConfig, 'locale' | 'messages'> & {
69
280
  /** Checks next locale is in provided array before switching locales */
70
281
  supportedLocales?: string[];
@@ -108,6 +319,18 @@ declare function registerNamespace<TDefault extends CompiledTranslation<UnknownS
108
319
  injectNamespaceT: () => TFunctionWithSignalConstructor<inferCompiledTranslationMap<TDefault>, TFunction<inferCompiledTranslationMap<TDefault>>>;
109
320
  resolveNamespaceTranslation: ResolveFn<void>;
110
321
  };
322
+ type UntypedTFunction<TNS extends string> = {
323
+ (key: `${TNS}.${string}`, args?: Record<string, string>): string;
324
+ asSignal: (key: `${TNS}.${string}`, args?: () => Record<string, string>) => Signal<string>;
325
+ };
326
+ /**
327
+ * Registers a type-unsafe namespace, meant for remote loading of unknown key-value pairs using mmstack/translate infrastructure
328
+ * The resolver & t function work the same as they would with typed namespaces, but without type safety
329
+ */
330
+ declare function registerRemoteNamespace<TNS extends string>(ns: TNS, defaultTranslation: () => Promise<Record<string, string>>, other: Record<string, () => Promise<Record<string, string>>>): {
331
+ injectNamespaceT: () => UntypedTFunction<TNS>;
332
+ resolveNamespaceTranslation: ResolveFn<void>;
333
+ };
111
334
 
112
335
  declare function injectResolveParamLocale(snapshot: ActivatedRouteSnapshot): string;
113
336
 
@@ -144,5 +367,5 @@ declare abstract class Translator<T extends CompiledTranslation<UnknownStringKey
144
367
  transform<K extends keyof TMap & string>(key: K, ...args: TMap[K] extends void ? [locale?: string] : [TMap[K], locale?: string]): string;
145
368
  }
146
369
 
147
- export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, registerNamespace };
148
- export type { CompiledTranslation, inferCompiledTranslationMap, inferCompiledTranslationNamespace, inferCompiledTranslationShape, mergeTranslationMaps };
370
+ export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, registerNamespace, registerRemoteNamespace };
371
+ export type { CompiledTranslation, FormatCurrencyOptions, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPercentOptions, FormatRelativeTimeOptions, RelativeTimeUnit, SupportedDateInput, SupportedListInput, inferCompiledTranslationMap, inferCompiledTranslationNamespace, inferCompiledTranslationShape, mergeTranslationMaps };