@mmstack/translate 21.1.5 → 21.1.7
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
|
@@ -572,6 +572,70 @@ export class MyComponent {
|
|
|
572
572
|
}
|
|
573
573
|
```
|
|
574
574
|
|
|
575
|
+
## Testing
|
|
576
|
+
|
|
577
|
+
When testing components that use `@mmstack/translate` (via `injectNamespaceT`, `Translate` directive, or `Translator` pipe), you don't need to configure actual translated namespaces or deal with Intl loading. Instead, use the provided `provideMockTranslations()` utility.
|
|
578
|
+
|
|
579
|
+
```typescript
|
|
580
|
+
import { TestBed } from '@angular/core/testing';
|
|
581
|
+
import { provideMockTranslations } from '@mmstack/translate';
|
|
582
|
+
import { MyComponent } from './my.component';
|
|
583
|
+
|
|
584
|
+
describe('MyComponent', () => {
|
|
585
|
+
beforeEach(() => {
|
|
586
|
+
TestBed.configureTestingModule({
|
|
587
|
+
imports: [MyComponent],
|
|
588
|
+
providers: [
|
|
589
|
+
// Automatically intercepts translation logic & skips real loading
|
|
590
|
+
provideMockTranslations(),
|
|
591
|
+
],
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it('should render translation keys directly', () => {
|
|
596
|
+
const fixture = TestBed.createComponent(MyComponent);
|
|
597
|
+
fixture.detectChanges();
|
|
598
|
+
|
|
599
|
+
// By default, it echoes back the flattened object key using dot notation
|
|
600
|
+
expect(fixture.nativeElement.textContent).toContain('myNamespace.greeting.title');
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
it('allows providing explicit mock overrides', () => {
|
|
604
|
+
TestBed.configureTestingModule({
|
|
605
|
+
providers: [
|
|
606
|
+
provideMockTranslations({
|
|
607
|
+
translations: {
|
|
608
|
+
myNamespace: { greeting: { title: 'Mocked Title' } },
|
|
609
|
+
},
|
|
610
|
+
}),
|
|
611
|
+
],
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
const fixture = TestBed.createComponent(MyComponent);
|
|
615
|
+
fixture.detectChanges();
|
|
616
|
+
expect(fixture.nativeElement.textContent).toContain('Mocked Title');
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
it('supports real ICU interpolation with formatValues', () => {
|
|
620
|
+
TestBed.configureTestingModule({
|
|
621
|
+
providers: [
|
|
622
|
+
provideMockTranslations({
|
|
623
|
+
translations: {
|
|
624
|
+
myNamespace: { greeting: { title: 'Hello {name}!' } },
|
|
625
|
+
},
|
|
626
|
+
formatValues: true, // enables @formatjs/intl processing
|
|
627
|
+
}),
|
|
628
|
+
],
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
const fixture = TestBed.createComponent(MyComponent);
|
|
632
|
+
fixture.detectChanges();
|
|
633
|
+
// Variables like {name} are now interpolated via @formatjs/intl
|
|
634
|
+
expect(fixture.nativeElement.textContent).toContain('Hello World!');
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
```
|
|
638
|
+
|
|
575
639
|
## Migration from Other Libraries
|
|
576
640
|
|
|
577
641
|
### From @angular/localize
|
|
@@ -600,4 +664,4 @@ Contributions, issues, and feature requests are welcome! Please see [CONTRIBUTIN
|
|
|
600
664
|
|
|
601
665
|
## License
|
|
602
666
|
|
|
603
|
-
MIT © [
|
|
667
|
+
MIT © [Miha Mulec](https://github.com/mihajm)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { computed, inject, InjectionToken, LOCALE_ID, signal, resource, untracked, isDevMode, effect, Injectable, isSignal, input, Renderer2, ElementRef, afterRenderEffect, Directive, ChangeDetectorRef } from '@angular/core';
|
|
3
3
|
import { createIntlCache, createIntl } from '@formatjs/intl';
|
|
4
4
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
@@ -44,7 +44,7 @@ function compileTranslation(translation, ns, locale) {
|
|
|
44
44
|
function createNamespace(ns, translation) {
|
|
45
45
|
const compiled = compileTranslation(translation, ns);
|
|
46
46
|
const namespace = {
|
|
47
|
-
translation:
|
|
47
|
+
translation: compiled,
|
|
48
48
|
createTranslation: (locale, translation) => {
|
|
49
49
|
return compileTranslation(translation, ns, locale);
|
|
50
50
|
},
|
|
@@ -153,7 +153,8 @@ class TranslationStore {
|
|
|
153
153
|
messages = computed(() => this.translations()[this.locale()] ??
|
|
154
154
|
this.translations()[this.defaultLocale] ??
|
|
155
155
|
{}, ...(ngDevMode ? [{ debugName: "messages" }] : []));
|
|
156
|
-
dynamicLocaleLoader = resource({
|
|
156
|
+
dynamicLocaleLoader = resource({
|
|
157
|
+
params: computed(() => this.loadQueue().at(0) ?? null),
|
|
157
158
|
loader: async ({ params: newLocale, abortSignal }) => {
|
|
158
159
|
if (!newLocale)
|
|
159
160
|
return;
|
|
@@ -189,7 +190,8 @@ class TranslationStore {
|
|
|
189
190
|
locales: res,
|
|
190
191
|
locale: newLocale,
|
|
191
192
|
}));
|
|
192
|
-
}
|
|
193
|
+
},
|
|
194
|
+
});
|
|
193
195
|
intl = computed(() => createIntl({
|
|
194
196
|
...this.nonMessageConfig(),
|
|
195
197
|
messages: this.messages(),
|
|
@@ -273,10 +275,10 @@ class TranslationStore {
|
|
|
273
275
|
hasLocaleLoaders(locale) {
|
|
274
276
|
return Array.from(this.onDemandLoaders.values()).some((loaders) => loaders[locale]);
|
|
275
277
|
}
|
|
276
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
277
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
278
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: TranslationStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
279
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: TranslationStore, providedIn: 'root' });
|
|
278
280
|
}
|
|
279
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: TranslationStore, decorators: [{
|
|
280
282
|
type: Injectable,
|
|
281
283
|
args: [{
|
|
282
284
|
providedIn: 'root',
|
|
@@ -469,6 +471,8 @@ function getFormatter$1(locale, minFractionDigits, maxFractionDigits, useGroupin
|
|
|
469
471
|
minimumFractionDigits: minFractionDigits,
|
|
470
472
|
maximumFractionDigits: maxFractionDigits,
|
|
471
473
|
useGrouping,
|
|
474
|
+
currency,
|
|
475
|
+
currencyDisplay: display,
|
|
472
476
|
});
|
|
473
477
|
cache$1.set(cacheKey, formatter);
|
|
474
478
|
}
|
|
@@ -488,7 +492,7 @@ function formatNumber(value, opt) {
|
|
|
488
492
|
if (unwrappedNumber === null)
|
|
489
493
|
return '';
|
|
490
494
|
const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
|
|
491
|
-
return getFormatter$1(loc, unwrappedOpt?.minFractionDigits
|
|
495
|
+
return getFormatter$1(loc, unwrappedOpt?.minFractionDigits, unwrappedOpt?.maxFractionDigits, unwrappedOpt?.useGrouping ?? true, unwrappedOpt?.notation ?? 'standard').format(unwrappedNumber);
|
|
492
496
|
}
|
|
493
497
|
/**
|
|
494
498
|
* Format a percentage using the current or provided locale
|
|
@@ -500,11 +504,11 @@ function formatNumber(value, opt) {
|
|
|
500
504
|
*/
|
|
501
505
|
function formatPercent(value, opt) {
|
|
502
506
|
const unwrappedOpt = unwrap(opt);
|
|
503
|
-
|
|
507
|
+
const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);
|
|
504
508
|
if (unwrappedNumber === null)
|
|
505
509
|
return '';
|
|
506
510
|
const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
|
|
507
|
-
return getFormatter$1(loc, unwrappedOpt?.minFractionDigits
|
|
511
|
+
return getFormatter$1(loc, unwrappedOpt?.minFractionDigits, unwrappedOpt?.maxFractionDigits, undefined, undefined, undefined, undefined, 'percent').format(unwrappedNumber);
|
|
508
512
|
}
|
|
509
513
|
function formatCurrency(value, currency, opt) {
|
|
510
514
|
const unwrappedOpt = unwrap(opt);
|
|
@@ -512,7 +516,7 @@ function formatCurrency(value, currency, opt) {
|
|
|
512
516
|
if (unwrappedValue === null)
|
|
513
517
|
return '';
|
|
514
518
|
const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();
|
|
515
|
-
return getFormatter$1(loc,
|
|
519
|
+
return getFormatter$1(loc, undefined, undefined, undefined, undefined, unwrap(currency), unwrappedOpt?.display ?? 'symbol', 'currency').format(unwrappedValue);
|
|
516
520
|
}
|
|
517
521
|
|
|
518
522
|
const cache = new Map();
|
|
@@ -787,18 +791,31 @@ class Translate {
|
|
|
787
791
|
const args = computed(() => {
|
|
788
792
|
const vars = this.translate();
|
|
789
793
|
return (Array.isArray(vars) ? vars[1] : undefined);
|
|
790
|
-
},
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
794
|
+
}, ...(ngDevMode ? [{ debugName: "args", equal: (a, b) => {
|
|
795
|
+
if (a === undefined && b === undefined)
|
|
796
|
+
return true;
|
|
797
|
+
if (a === undefined || b === undefined)
|
|
798
|
+
return false;
|
|
799
|
+
const aObj = a;
|
|
800
|
+
const keys = Object.keys(aObj);
|
|
801
|
+
const bObj = b;
|
|
802
|
+
if (!keys.length)
|
|
803
|
+
return !Object.keys(bObj).length;
|
|
804
|
+
return keys.every((key) => aObj[key] === bObj[key]);
|
|
805
|
+
} }] : [{
|
|
806
|
+
equal: (a, b) => {
|
|
807
|
+
if (a === undefined && b === undefined)
|
|
808
|
+
return true;
|
|
809
|
+
if (a === undefined || b === undefined)
|
|
810
|
+
return false;
|
|
811
|
+
const aObj = a;
|
|
812
|
+
const keys = Object.keys(aObj);
|
|
813
|
+
const bObj = b;
|
|
814
|
+
if (!keys.length)
|
|
815
|
+
return !Object.keys(bObj).length;
|
|
816
|
+
return keys.every((key) => aObj[key] === bObj[key]);
|
|
817
|
+
},
|
|
818
|
+
}]));
|
|
802
819
|
const translation = computed(() => this.t(key(), args()), ...(ngDevMode ? [{ debugName: "translation" }] : []));
|
|
803
820
|
const renderer = inject(Renderer2);
|
|
804
821
|
const el = inject(ElementRef);
|
|
@@ -808,10 +825,10 @@ class Translate {
|
|
|
808
825
|
},
|
|
809
826
|
});
|
|
810
827
|
}
|
|
811
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
812
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
828
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: Translate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
829
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.17", type: Translate, isStandalone: true, inputs: { translate: { classPropertyName: "translate", publicName: "translate", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
813
830
|
}
|
|
814
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: Translate, decorators: [{
|
|
815
832
|
type: Directive
|
|
816
833
|
}], ctorParameters: () => [], propDecorators: { translate: [{ type: i0.Input, args: [{ isSignal: true, alias: "translate", required: true }] }] } });
|
|
817
834
|
|
|
@@ -831,9 +848,75 @@ class Translator {
|
|
|
831
848
|
}
|
|
832
849
|
}
|
|
833
850
|
|
|
851
|
+
/**
|
|
852
|
+
* Provides an isolated mock `TranslationStore` usable across testing modules that use components
|
|
853
|
+
* depending on `@mmstack/translate` APIs (like `Translate` directive, `Translator` pipe, or `injectNamespaceT`).
|
|
854
|
+
*
|
|
855
|
+
* This provider intercepts all translation logic, bypassing chunk loaders and Intl.
|
|
856
|
+
* When a custom configuration isn't provided, formatMessage simply echoes the translation key, using dots `.`.
|
|
857
|
+
*
|
|
858
|
+
* ### Usage
|
|
859
|
+
* ```typescript
|
|
860
|
+
* TestBed.configureTestingModule({
|
|
861
|
+
* providers: [provideMockTranslations()]
|
|
862
|
+
* });
|
|
863
|
+
* ```
|
|
864
|
+
*/
|
|
865
|
+
function provideMockTranslations(options) {
|
|
866
|
+
// We compile the mock strings to flat delimiters just like the internal compile module.
|
|
867
|
+
const mappedMocks = {};
|
|
868
|
+
if (options?.translations) {
|
|
869
|
+
for (const [namespace, translationObj] of Object.entries(options.translations)) {
|
|
870
|
+
const compiled = compileTranslation(translationObj, namespace);
|
|
871
|
+
for (const [key, val] of Object.entries(compiled.flat)) {
|
|
872
|
+
// e.g. from 'home::MMT_DELIM::title'
|
|
873
|
+
const fullKey = `${namespace}::MMT_DELIM::${key}`;
|
|
874
|
+
mappedMocks[fullKey] = val;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const locale = options?.locale ?? 'en-US';
|
|
879
|
+
let intl;
|
|
880
|
+
if (options?.formatValues) {
|
|
881
|
+
intl = createIntl({ locale, messages: mappedMocks }, createIntlCache());
|
|
882
|
+
}
|
|
883
|
+
return [
|
|
884
|
+
{
|
|
885
|
+
provide: TranslationStore,
|
|
886
|
+
useValue: {
|
|
887
|
+
locale: signal(locale),
|
|
888
|
+
formatMessage: (key, values) => {
|
|
889
|
+
const message = mappedMocks[key];
|
|
890
|
+
if (!message) {
|
|
891
|
+
// Fallback to echoing the key back in dot notation (more readable for unit assertions).
|
|
892
|
+
return key.replaceAll('::MMT_DELIM::', '.');
|
|
893
|
+
}
|
|
894
|
+
if (intl) {
|
|
895
|
+
return intl.formatMessage({ id: key, defaultMessage: message }, values);
|
|
896
|
+
}
|
|
897
|
+
return message;
|
|
898
|
+
},
|
|
899
|
+
hasLocaleLoaders: () => false,
|
|
900
|
+
register: () => {
|
|
901
|
+
// noop
|
|
902
|
+
},
|
|
903
|
+
registerOnDemandLoaders: () => {
|
|
904
|
+
// noop
|
|
905
|
+
},
|
|
906
|
+
dynamicLocaleLoader: {
|
|
907
|
+
isLoading: signal(false),
|
|
908
|
+
value: signal(null),
|
|
909
|
+
error: signal(null),
|
|
910
|
+
},
|
|
911
|
+
loadQueue: signal([]),
|
|
912
|
+
},
|
|
913
|
+
},
|
|
914
|
+
];
|
|
915
|
+
}
|
|
916
|
+
|
|
834
917
|
/**
|
|
835
918
|
* Generated bundle index. Do not edit.
|
|
836
919
|
*/
|
|
837
920
|
|
|
838
|
-
export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, registerNamespace, registerRemoteNamespace };
|
|
921
|
+
export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, provideMockTranslations, registerNamespace, registerRemoteNamespace };
|
|
839
922
|
//# 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/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,MAAM,SAAS,GAAG,eAAe;AAE3B,SAAU,YAAY,CAAC,MAAc,EAAE,GAAW,EAAA;AACtD,IAAA,OAAO,GAAG,MAAM,CAAA,EAAG,SAAS,CAAA,EAAG,GAAG,EAAE;AACtC;SAEgB,gBAAgB,CAAC,GAAW,EAAE,IAAI,GAAG,GAAG,EAAA;IACtD,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC;AACxC;;ACDA,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAyChE,SAAS,mBAAmB,CAAC,CAAU,EAAA;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;AAC5C;AAEA,SAAS,kBAAkB,CAAm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ib/delim.ts","../../../../packages/translate/src/lib/compile.ts","../../../../packages/translate/src/lib/create-namespace.ts","../../../../packages/translate/src/lib/path-param.ts","../../../../packages/translate/src/lib/translation-store.ts","../../../../packages/translate/src/lib/format/unwrap.ts","../../../../packages/translate/src/lib/format/date.ts","../../../../packages/translate/src/lib/format/display-name.ts","../../../../packages/translate/src/lib/format/list.ts","../../../../packages/translate/src/lib/format/numeric.ts","../../../../packages/translate/src/lib/format/relative-time.ts","../../../../packages/translate/src/lib/resovler-locale.ts","../../../../packages/translate/src/lib/register-namespace.ts","../../../../packages/translate/src/lib/route-helpers.ts","../../../../packages/translate/src/lib/translate.ts","../../../../packages/translate/src/lib/translator.ts","../../../../packages/translate/src/lib/testing/provide-mock-translations.ts","../../../../packages/translate/src/mmstack-translate.ts"],"sourcesContent":["const KEY_DELIM = '::MMT_DELIM::';\n\nexport function prependDelim(prefix: string, key: string): string {\n return `${prefix}${KEY_DELIM}${key}`;\n}\n\nexport function replaceWithDelim(str: string, repl = '.'): string {\n return str.replaceAll(repl, KEY_DELIM);\n}\n","import { prependDelim } from './delim';\nimport type {\n inferTranslationParamMap,\n inferTranslationShape,\n} from './parameterize.type';\nimport type { UnknownStringKeyObject } from './string-key-object.type';\n\nconst INTERNAL_SYMBOL = Symbol.for('mmstack-translate-internal');\n\ntype InternalSymbol = typeof INTERNAL_SYMBOL;\n\nexport type CompiledTranslation<\n T extends UnknownStringKeyObject,\n TNS extends string,\n TLocale extends string = string,\n> = {\n flat: Record<string, string>;\n locale?: TLocale;\n namespace: TNS;\n [INTERNAL_SYMBOL]: {\n shape: inferTranslationShape<T>;\n map: inferTranslationParamMap<TNS, T>;\n };\n};\n\nexport type mergeTranslationMaps<\n TMain extends CompiledTranslation<UnknownStringKeyObject, string>,\n TOther extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = Omit<TMain, InternalSymbol> & {\n [INTERNAL_SYMBOL]: {\n shape: inferCompiledTranslationShape<TMain>;\n map: inferCompiledTranslationMap<TOther> &\n inferCompiledTranslationMap<TMain>;\n };\n};\n\nexport type inferCompiledTranslationNamespace<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T['namespace'];\n\nexport type inferCompiledTranslationShape<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T[InternalSymbol]['shape'];\n\nexport type inferCompiledTranslationMap<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n> = T[InternalSymbol]['map'];\n\nfunction isTranslationObject(t: unknown): t is UnknownStringKeyObject {\n return typeof t === 'object' && t !== null;\n}\n\nfunction flattenTranslation<T extends UnknownStringKeyObject>(obj: T) {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n if (typeof value === 'string') {\n acc[key] = value;\n } else if (isTranslationObject(value)) {\n Object.entries(flattenTranslation(value)).forEach(\n ([nestedKey, nestedValue]) => {\n acc[prependDelim(key, nestedKey)] = nestedValue;\n },\n );\n }\n\n return acc;\n },\n {} as Record<string, string>,\n );\n}\n\nexport function compileTranslation<\n T extends UnknownStringKeyObject,\n TNS extends string,\n TLocale extends string = string,\n>(\n translation: T,\n ns: TNS,\n locale?: TLocale,\n): CompiledTranslation<T, TNS, TLocale> {\n type $Shape = inferTranslationShape<T>;\n type $Map = inferTranslationParamMap<TNS, T>;\n\n return {\n locale,\n flat: flattenTranslation(translation),\n namespace: ns,\n [INTERNAL_SYMBOL]: {\n shape: {} as $Shape,\n map: {} as $Map,\n },\n };\n}\n","import {\n type CompiledTranslation,\n compileTranslation,\n type inferCompiledTranslationShape,\n type mergeTranslationMaps,\n} from './compile';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\n\ntype TranslationNamespace<\n TNS extends string,\n T extends CompiledTranslation<UnknownStringKeyObject, TNS>,\n TShape extends UnknownStringKeyObject,\n> = {\n translation: T;\n createTranslation: <TLocale extends string>(\n locale: TLocale,\n translation: TShape,\n ) => CompiledTranslation<TShape, TNS, TLocale>;\n createMergedNamespace: <\n TOtherNS extends string,\n const TOther extends UnknownStringKeyObject,\n TOtherCompiled extends CompiledTranslation<TOther, TOtherNS>,\n >(\n ns: TOtherNS,\n translation: TOther,\n ) => TranslationNamespace<\n TOtherNS,\n mergeTranslationMaps<TOtherCompiled, T>,\n inferCompiledTranslationShape<TOtherCompiled>\n >;\n};\n\nexport function createNamespace<\n const T extends UnknownStringKeyObject,\n TNS extends string,\n>(ns: TNS, translation: T) {\n const compiled = compileTranslation<T, TNS>(translation, ns);\n\n type TCompiled = typeof compiled;\n type TShape = inferCompiledTranslationShape<typeof compiled>;\n\n const namespace: TranslationNamespace<TNS, TCompiled, TShape> = {\n translation: compiled,\n createTranslation: <TLocale extends string>(\n locale: TLocale,\n translation: TShape,\n ) => {\n return compileTranslation(translation, ns, locale);\n },\n createMergedNamespace: <\n TOther extends UnknownStringKeyObject,\n TOtherNS extends string,\n TOtherCompiled extends CompiledTranslation<TOther, TOtherNS> =\n CompiledTranslation<TOther, TOtherNS>,\n >(\n otherNs: TOtherNS,\n otherTranslation: TOther,\n ) => {\n return createNamespace(otherNs, otherTranslation) as TranslationNamespace<\n TOtherNS,\n mergeTranslationMaps<TOtherCompiled, TCompiled>,\n inferCompiledTranslationShape<TOtherCompiled>\n > as unknown as any;\n },\n };\n\n return namespace;\n}\n","import { computed, inject, type Signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, type ParamMap, Router } from '@angular/router';\n\nexport function pathParam(\n key: string | (() => string),\n route = inject(ActivatedRoute),\n): Signal<string | null> {\n const keySignal =\n typeof key === 'string' ? computed(() => key) : computed(key);\n\n const routerOptions = inject(Router)['options'];\n\n if (\n routerOptions &&\n typeof routerOptions === 'object' &&\n routerOptions.paramsInheritanceStrategy === 'always'\n ) {\n const params = toSignal(route.paramMap, {\n initialValue: route.snapshot.paramMap,\n });\n\n return computed(() => params().get(keySignal()));\n }\n\n const paramMapSignals: Signal<ParamMap>[] = [];\n let currentRoute: ActivatedRoute | null = route;\n\n const isStatic = typeof key === 'string';\n\n while (currentRoute) {\n const initial = currentRoute.snapshot.paramMap;\n paramMapSignals.push(\n toSignal(currentRoute.paramMap, {\n initialValue: initial,\n }),\n );\n\n // For static keys, stop once we find the param, will find first in computed for loop already so basically noop for for loop\n if (isStatic && initial.has(key as string)) break;\n\n currentRoute = currentRoute.parent;\n }\n\n return computed(() => {\n const paramKey = keySignal();\n\n for (const map of paramMapSignals) {\n const v = map().get(paramKey);\n if (v) return v;\n }\n\n return null;\n });\n}\n","import {\n computed,\n effect,\n inject,\n Injectable,\n InjectionToken,\n isDevMode,\n LOCALE_ID,\n type Provider,\n resource,\n type Signal,\n signal,\n untracked,\n type WritableSignal,\n} from '@angular/core';\nimport { createIntl, createIntlCache, type IntlConfig } from '@formatjs/intl';\nimport { type CompiledTranslation } from './compile';\nimport { prependDelim } from './delim';\nimport { pathParam } from './path-param';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\n\nconst CONFIG_TOKEN = new InjectionToken<\n Omit<IntlConfig, 'locale' | 'messages'> & {\n supportedLocales?: string[];\n preloadDefaultLocale?: boolean;\n localeParamName?: string;\n }\n>('mmstack-intl-config');\n\nexport function provideIntlConfig(\n config: Omit<IntlConfig, 'locale' | 'messages'> & {\n /** Checks next locale is in provided array before switching locales */\n supportedLocales?: string[];\n /** Preloads the default locale ensuring sync fallback, not necessary for most cases as it will lazily load automatically when needed */\n preloadDefaultLocale?: boolean;\n /** Auto-resolution when using a locale parameter via angular router */\n localeParamName?: string;\n },\n): Provider[] {\n const providers: Provider[] = [\n {\n useFactory: (localeId: string) => {\n const next = {\n ...config,\n };\n\n const defaultLocale =\n config.defaultLocale ?? config.supportedLocales?.at(0) ?? localeId;\n\n if (\n next.supportedLocales &&\n !next.supportedLocales.includes(defaultLocale)\n ) {\n next.supportedLocales = [...next.supportedLocales, defaultLocale];\n }\n\n return next;\n },\n deps: [LOCALE_ID],\n provide: CONFIG_TOKEN,\n },\n ];\n\n const defaultLocale = config.defaultLocale ?? config.supportedLocales?.at(0);\n\n if (!defaultLocale) return providers;\n\n providers.push({\n provide: LOCALE_ID,\n useValue: defaultLocale,\n });\n\n return providers;\n}\n\nexport function injectIntlConfig() {\n return inject(CONFIG_TOKEN, { optional: true }) ?? undefined;\n}\n\nexport function injectDefaultLocale() {\n return injectIntlConfig()?.defaultLocale ?? inject(LOCALE_ID) ?? 'en-US';\n}\n\nexport function injectSupportedLocales() {\n return injectIntlConfig()?.supportedLocales ?? [injectDefaultLocale()];\n}\n\n/**\n * @internal\n * the actual locale signal used to store the current locale string\n */\nconst STORE_LOCALE = signal('en-US');\n\nexport function injectLocaleInternal() {\n return STORE_LOCALE;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TranslationStore {\n private readonly cache = createIntlCache();\n private readonly config = injectIntlConfig();\n readonly loadQueue = signal<string[]>([]);\n readonly locale: WritableSignal<string>;\n private readonly defaultLocale = injectDefaultLocale();\n private readonly translations = signal<\n Record<string, Record<string, string>>\n >({\n [this.defaultLocale]: {},\n });\n private attemptedFallbackLoad = false;\n\n private readonly onDemandLoaders = new Map<\n string,\n Record<\n string,\n () => Promise<CompiledTranslation<UnknownStringKeyObject, string>>\n >\n >();\n\n private readonly nonMessageConfig = computed(() => ({\n ...this.config,\n locale: this.locale(),\n }));\n\n private readonly messages = computed(\n () =>\n this.translations()[this.locale()] ??\n this.translations()[this.defaultLocale] ??\n {},\n );\n\n readonly dynamicLocaleLoader = resource({\n params: computed(() => this.loadQueue().at(0) ?? null),\n loader: async ({ params: newLocale, abortSignal }) => {\n if (!newLocale) return;\n\n const currentTranslations = untracked(this.translations);\n\n const loadPromises: Promise<{\n namespace: string;\n flat: Record<string, string>;\n } | null>[] = [];\n\n for (const [namespace, loaders] of this.onDemandLoaders.entries()) {\n const loader = loaders[newLocale];\n if (loader) {\n const hasNamespaceForLocale =\n currentTranslations[newLocale] &&\n Object.keys(currentTranslations[newLocale]).some((key) =>\n key.startsWith(`${prependDelim(namespace, '').slice(0, -1)}`),\n );\n\n if (!hasNamespaceForLocale) {\n loadPromises.push(\n loader()\n .then((translation) => {\n if (abortSignal.aborted) return null;\n return {\n namespace: translation.namespace,\n flat: translation.flat,\n };\n })\n .catch((err) => {\n if (isDevMode()) {\n console.error(\n '[Translate] Failed to load',\n namespace,\n newLocale,\n err,\n );\n }\n\n return null;\n }),\n );\n }\n }\n }\n\n return Promise.all(loadPromises)\n .then((res) => res.filter((r) => r !== null))\n .then((res) => ({\n locales: res,\n locale: newLocale,\n }));\n },\n });\n\n readonly intl = computed(() =>\n createIntl(\n {\n ...this.nonMessageConfig(),\n messages: this.messages(),\n },\n this.cache,\n ),\n );\n\n constructor() {\n this.locale = STORE_LOCALE;\n this.locale.set(injectDefaultLocale());\n const paramName = this.config?.localeParamName;\n if (paramName) {\n const param = pathParam(paramName);\n\n effect(() => {\n const loc = param();\n if (\n !loc ||\n loc === untracked(this.locale) ||\n untracked(this.loadQueue).includes(loc)\n )\n return;\n if (this.hasLocaleLoaders(loc)) this.locale.set(loc);\n else this.loadQueue.update((q) => [...q, loc]);\n });\n }\n\n effect(() => {\n if (\n // should never be in error state, but best to check in case something throws\n this.dynamicLocaleLoader.error() ||\n this.dynamicLocaleLoader.isLoading()\n )\n return;\n const dynamicLocales = this.dynamicLocaleLoader.value();\n\n if (!dynamicLocales) return;\n\n // Register loaded translations\n for (const locale of dynamicLocales.locales) {\n this.register(locale.namespace, {\n [dynamicLocales.locale]: locale.flat,\n });\n }\n\n const hasTranslations =\n dynamicLocales.locales.length > 0 ||\n this.translations()[dynamicLocales.locale];\n\n if (hasTranslations) {\n this.loadQueue.update((q) =>\n q.filter((l) => l !== dynamicLocales.locale),\n );\n this.locale.set(dynamicLocales.locale);\n }\n });\n }\n\n formatMessage(key: string, values?: Record<string, string | number>) {\n const message =\n this.translations()[this.locale()]?.[key] ??\n this.translations()[this.defaultLocale]?.[key] ??\n '';\n\n if (!message) {\n if (this.attemptedFallbackLoad) return '';\n\n this.attemptedFallbackLoad = true;\n untracked(() => {\n if (!this.loadQueue().includes(this.defaultLocale))\n this.loadQueue.update((q) => [...q, this.defaultLocale]);\n });\n return '';\n }\n\n return this.intl().formatMessage(\n { id: key, defaultMessage: message },\n values,\n );\n }\n\n register(\n namespace: string,\n flat: Partial<Record<string, Record<string, string>>>,\n ) {\n this.translations.update((cur) => {\n return Object.entries(flat).reduce(\n (acc, [locale, translation]) => {\n const localeTranslation = acc[locale] ?? {};\n\n const withNS = Object.entries(translation ?? {}).reduce(\n (acc, [key, value]) => {\n acc[prependDelim(namespace, key)] = value;\n return acc;\n },\n {} as Record<string, string>,\n );\n\n acc[locale] = {\n ...localeTranslation,\n ...withNS,\n };\n\n return acc;\n },\n { ...cur },\n );\n });\n }\n\n registerOnDemandLoaders(\n namespace: string,\n loaders: Record<string, () => Promise<any>>,\n ) {\n this.onDemandLoaders.set(namespace, loaders);\n }\n\n hasLocaleLoaders(locale: string): boolean {\n return Array.from(this.onDemandLoaders.values()).some(\n (loaders) => loaders[locale],\n );\n }\n}\n\nexport function injectIntl() {\n return inject(TranslationStore).intl;\n}\n\n/**\n * Inject a dynamic locale signal that supports runtime language switching.\n *\n * @returns A writable signal with the current locale and loading state.\n * Only allows switching to locales that have registered loaders.\n *\n * @example\n * ```typescript\n * const locale = injectDynamicLocale();\n *\n * // Switch language (triggers automatic translation loading)\n * locale.set('sl-SI');\n *\n * // Check loading state\n * if (locale.isLoading()) {\n * // Show spinner\n * }\n * ```\n */\nexport function injectDynamicLocale(): WritableSignal<string> & {\n isLoading: Signal<boolean>;\n} {\n const store = inject(TranslationStore);\n const supportedLocales = injectIntlConfig()?.supportedLocales;\n\n const source = computed(() => store.locale()) as WritableSignal<string> & {\n isLoading: Signal<boolean>;\n };\n\n const inSupportedLocales =\n supportedLocales === undefined\n ? () => true\n : (locale: string) => supportedLocales.includes(locale);\n\n const set = (value: string) => {\n if (\n value === untracked(source) ||\n untracked(store.loadQueue).includes(value)\n )\n return;\n\n if (!inSupportedLocales(value)) {\n if (isDevMode())\n console.warn(\n `[Translate] Locale \"${value}\" is not in supportedLocales, switch prevented. Available options are:`,\n supportedLocales,\n );\n\n return;\n }\n\n if (isDevMode() && !store.hasLocaleLoaders(value))\n console.warn(\n `[Translate] No loaders registered for locale \"${value}\". Switching to this locale will have no effect.`,\n );\n\n store.loadQueue.update((q) => [...q, value]);\n };\n\n source.set = set;\n source.update = (updater: (value: string) => string) => {\n const next = updater(untracked(source));\n source.set(next);\n };\n source.asReadonly = () => source;\n\n source.isLoading = store.dynamicLocaleLoader.isLoading;\n\n return source;\n}\n","import { isSignal, type Signal } from '@angular/core';\n\nexport function unwrap<T>(value: T | Signal<T>): T {\n return isSignal(value) ? value() : value;\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst FORMAT_PRESETS: Record<string, Intl.DateTimeFormatOptions> = {\n short: { dateStyle: 'short', timeStyle: 'short' },\n medium: { dateStyle: 'medium', timeStyle: 'medium' },\n long: { dateStyle: 'long', timeStyle: 'long' },\n full: { dateStyle: 'full', timeStyle: 'full' },\n\n shortDate: { dateStyle: 'short' },\n mediumDate: { dateStyle: 'medium' },\n longDate: { dateStyle: 'long' },\n fullDate: { dateStyle: 'full' },\n\n shortTime: { timeStyle: 'short' },\n mediumTime: { timeStyle: 'medium' },\n longTime: { timeStyle: 'long' },\n fullTime: { timeStyle: 'full' },\n};\n\ntype DateFormat = keyof typeof FORMAT_PRESETS;\n\n/**\n * Supported date inputs\n */\nexport type SupportedDateInput = Date | string | number | null | undefined;\n\n/**\n * Options for formatting a date\n */\nexport type FormatDateOptions = {\n /**\n * Timezone to use for formatting\n */\n tz?: string;\n /**\n * Format to use for formatting\n * @default 'medium'\n */\n format?: DateFormat;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction validDateOrNull(\n date: Date | string | number | null | undefined,\n): Date | null {\n if (date == null) return null;\n\n const d = date instanceof Date ? date : new Date(date);\n return isNaN(d.getTime()) ? null : d;\n}\n\nconst cache = new Map<string, Intl.DateTimeFormat>();\n\nfunction getFormatter(\n locale: string,\n format: DateFormat,\n timeZone?: string,\n): Intl.DateTimeFormat {\n const cacheKey = `${locale}|${format}|${timeZone ?? ''}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(locale, {\n ...FORMAT_PRESETS[format],\n timeZone,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a date using the current or provided locale & timezone\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param date - Date to format\n * @param opt - Options for formatting\n * @returns Formatted date string\n */\nexport function formatDate(\n date: SupportedDateInput | Signal<SupportedDateInput>,\n opt?: FormatDateOptions | Signal<FormatDateOptions>,\n): string {\n const validDate = validDateOrNull(unwrap(date));\n if (validDate === null) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.format ?? 'medium',\n unwrappedOpt?.tz,\n ).format(validDate);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst cache = new Map<string, Intl.DisplayNames>();\n\n/**\n * Options for formatting a display name\n */\nexport type FormatDisplayNameOptions = {\n /**\n * The display style for the result set\n */\n style: Intl.RelativeTimeFormatStyle;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction getFormatter(\n locale: string,\n type: Intl.DisplayNamesType,\n style: Intl.RelativeTimeFormatStyle,\n): Intl.DisplayNames {\n const cacheKey = `${locale}|${type}|${style}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.DisplayNames(locale, {\n type,\n style,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\ntype SupportedCode = string | null | undefined;\n\n/**\n * Format a display name using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The code to format\n * @param type - The type of display name to format\n * @param opt - Options for formatting\n * @returns Formatted display name string\n */\nexport function formatDisplayName(\n value: SupportedCode | Signal<SupportedCode>,\n type: Intl.DisplayNamesType | Signal<Intl.DisplayNamesType>,\n opt?: FormatDisplayNameOptions | Signal<FormatDisplayNameOptions>,\n): string {\n const unwrapped = unwrap(value);\n if (!unwrapped?.trim()) return '';\n\n const unwrappedType = unwrap(type);\n const unwrappedOpt = unwrap(opt);\n\n const locale = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return (\n getFormatter(locale, unwrappedType, unwrappedOpt?.style ?? 'long').of(\n unwrapped,\n ) ?? ''\n );\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\ntype ListType = 'conjunction' | 'disjunction' | 'unit';\ntype ListStyle = 'long' | 'short' | 'narrow';\n\nexport type SupportedListInput = string[] | null | undefined;\n\nconst cache = new Map<string, Intl.ListFormat>();\n\n/**\n * Options for formatting a list\n */\nexport type FormatListOptions = {\n /**\n * The type of list to format\n */\n type?: ListType;\n /**\n * The style of list to format\n */\n style?: ListStyle;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nconst EMPTY_ARRAY: string[] = [];\n\nfunction unwrapList(\n value: SupportedListInput | Signal<SupportedListInput>,\n): string[] {\n const unwrapped = unwrap(value);\n return Array.isArray(unwrapped) ? unwrapped : EMPTY_ARRAY;\n}\n\nfunction getFormatter(\n locale: string,\n type: ListType,\n style: ListStyle,\n): Intl.ListFormat {\n const cacheKey = `${locale}|${type}|${style}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.ListFormat(locale, { type, style });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a list using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The list to format\n * @param opt - Options for formatting\n * @returns Formatted list string\n */\nexport function formatList(\n value: SupportedListInput | Signal<SupportedListInput>,\n opt?: FormatListOptions | Signal<FormatListOptions>,\n): string {\n const unwrapped = unwrapList(value);\n if (unwrapped.length === 0) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.type ?? 'conjunction',\n unwrappedOpt?.style ?? 'long',\n ).format(unwrapped);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\ntype NumberNotation = 'standard' | 'scientific' | 'engineering' | 'compact';\n\ntype SupportedNumberValue = number | null | undefined;\n\nconst cache = new Map<string, Intl.NumberFormat>();\n\nfunction unwrapValue(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n fallbackToZero = false,\n): number | null {\n const unwrapped = unwrap(value);\n\n if (unwrapped === null || unwrapped === undefined || isNaN(unwrapped))\n return fallbackToZero ? 0 : null;\n\n return unwrapped;\n}\n\n/**\n * Options for formatting a number\n */\nexport type FormatNumberOptions = {\n /**\n * The notation to use for formatting\n */\n notation?: NumberNotation;\n /**\n * Minimum number of fraction digits to use\n */\n minFractionDigits?: number;\n /**\n * Maximum number of fraction digits to use\n */\n maxFractionDigits?: number;\n /**\n * Whether to use grouping\n */\n useGrouping?: boolean;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\nfunction getFormatter(\n locale: string,\n minFractionDigits: number | undefined,\n maxFractionDigits: number | undefined,\n useGrouping?: boolean,\n notation?: NumberNotation,\n currency?: string,\n display?: CurrencyDisplay,\n style?: 'currency' | 'percent',\n): Intl.NumberFormat {\n const cacheKey = `${locale}|${notation ?? 'standard'}|${minFractionDigits}|${maxFractionDigits}|${useGrouping ?? true}|${currency ?? 'none'}|${display ?? 'none'}|${style ?? 'decimal'}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, {\n style,\n notation,\n minimumFractionDigits: minFractionDigits,\n maximumFractionDigits: maxFractionDigits,\n useGrouping,\n currency,\n currencyDisplay: display,\n });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\n/**\n * Format a number using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param number - Number to format\n * @param opt - Options for formatting\n * @returns Formatted number string\n */\nexport function formatNumber(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n opt?: FormatNumberOptions | Signal<FormatNumberOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedNumber === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.minFractionDigits,\n unwrappedOpt?.maxFractionDigits,\n unwrappedOpt?.useGrouping ?? true,\n unwrappedOpt?.notation ?? 'standard',\n ).format(unwrappedNumber);\n}\n\n/**\n * Options for formatting a percentage value\n */\nexport type FormatPercentOptions = {\n /**\n * Minimum number of fraction digits to use\n */\n minFractionDigits?: number;\n /**\n * Maximum number of fraction digits to use\n */\n maxFractionDigits?: number;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\n/**\n * Format a percentage using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param number - Number to format\n * @param opt - Options for formatting\n * @returns Formatted percentage string\n */\nexport function formatPercent(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n opt?: FormatPercentOptions | Signal<FormatPercentOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n\n const unwrappedNumber = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedNumber === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.minFractionDigits,\n unwrappedOpt?.maxFractionDigits,\n undefined,\n undefined,\n undefined,\n undefined,\n 'percent',\n ).format(unwrappedNumber);\n}\n\ntype CurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name';\n\n/**\n * Options for formatting a currency\n */\nexport type FormatCurrencyOptions = {\n /*\n * The display type for the currency format\n */\n display?: CurrencyDisplay;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n /**\n * If the number is not a valid number, return formatted 0. By default formatter returns an empty string\n * @default false\n */\n fallbackToZero?: boolean;\n};\n\nexport function formatCurrency(\n value: SupportedNumberValue | Signal<SupportedNumberValue>,\n currency: string | Signal<string>,\n opt?: FormatCurrencyOptions | Signal<FormatCurrencyOptions>,\n): string {\n const unwrappedOpt = unwrap(opt);\n const unwrappedValue = unwrapValue(value, unwrappedOpt?.fallbackToZero);\n\n if (unwrappedValue === null) return '';\n\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n undefined,\n undefined,\n undefined,\n undefined,\n unwrap(currency),\n unwrappedOpt?.display ?? 'symbol',\n 'currency',\n ).format(unwrappedValue);\n}\n","import { type Signal } from '@angular/core';\nimport { injectLocaleInternal } from '../translation-store';\nimport { unwrap } from './unwrap';\n\nconst cache = new Map<string, Intl.RelativeTimeFormat>();\n\n/**\n * Options for formatting a relative time value\n */\nexport type FormatRelativeTimeOptions = {\n /**\n * The length of the internationalized message.\n * @default 'long'\n */\n style?: Intl.RelativeTimeFormatStyle;\n /**\n * Controls whether to use numeric values in the output.\n * @default 'always'\n */\n numeric?: Intl.RelativeTimeFormatNumeric;\n /**\n * Locale to use for formatting, opts out to dynamic locale changes\n */\n locale?: string;\n};\n\nfunction getFormatter(\n locale: string,\n style: Intl.RelativeTimeFormatStyle,\n numeric: Intl.RelativeTimeFormatNumeric,\n): Intl.RelativeTimeFormat {\n const cacheKey = `${locale}|${style}|${numeric}`;\n let formatter = cache.get(cacheKey);\n\n if (!formatter) {\n formatter = new Intl.RelativeTimeFormat(locale, { style, numeric });\n cache.set(cacheKey, formatter);\n }\n\n return formatter;\n}\n\nexport type RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\ntype SupportedRelativeTimeInput = number | null | undefined;\n\n/**\n * Format a relative time using the current or provided locale\n * By default it is reactive to the global dynamic locale, works best when wrapped in a computed() if you need to react to locale changes\n *\n * @param value - The numeric value to use in the relative time internationalization message\n * @param unit - The unit to use in the relative time internationalization message\n * @param opt - Options for formatting\n * @returns Formatted relative time string\n */\nexport function formatRelativeTime(\n value: SupportedRelativeTimeInput | Signal<SupportedRelativeTimeInput>,\n unit: RelativeTimeUnit | Signal<RelativeTimeUnit>,\n opt?: FormatRelativeTimeOptions | Signal<FormatRelativeTimeOptions>,\n): string {\n const unwrappedValue = unwrap(value);\n if (\n unwrappedValue === null ||\n unwrappedValue === undefined ||\n isNaN(unwrappedValue)\n )\n return '';\n\n const unwrappedUnit = unwrap(unit);\n if (!unwrappedUnit) return '';\n\n const unwrappedOpt = unwrap(opt);\n const loc = unwrappedOpt?.locale ?? injectLocaleInternal()();\n\n return getFormatter(\n loc,\n unwrappedOpt?.style ?? 'long',\n unwrappedOpt?.numeric ?? 'always',\n ).format(unwrappedValue, unwrappedUnit);\n}\n","import { inject, untracked } from '@angular/core';\nimport { type ActivatedRouteSnapshot, Router } from '@angular/router';\nimport { injectIntlConfig, TranslationStore } from './translation-store';\n\nexport function injectResolveParamLocale(snapshot: ActivatedRouteSnapshot) {\n let locale: string | null = null;\n\n const paramName = injectIntlConfig()?.localeParamName;\n\n const routerConfig = inject(Router)['options'];\n\n const alwaysInheritParams =\n typeof routerConfig === 'object' &&\n !!routerConfig &&\n routerConfig.paramsInheritanceStrategy === 'always';\n\n if (paramName) {\n locale = snapshot.paramMap.get(paramName);\n\n if (!locale && !alwaysInheritParams) {\n let currentRoute: ActivatedRouteSnapshot | null = snapshot;\n while (currentRoute && !locale) {\n locale = currentRoute.paramMap.get('locale');\n currentRoute = currentRoute.parent;\n }\n }\n }\n\n if (!locale) {\n locale = untracked(inject(TranslationStore).locale);\n }\n\n return locale;\n}\n","import {\n computed,\n inject,\n isDevMode,\n isSignal,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { type ResolveFn } from '@angular/router';\nimport {\n compileTranslation,\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n type inferCompiledTranslationNamespace,\n} from './compile';\nimport { replaceWithDelim } from './delim';\nimport { injectResolveParamLocale } from './resovler-locale';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport {\n injectDefaultLocale,\n injectIntlConfig,\n TranslationStore,\n} from './translation-store';\n\n \ntype AnyStringRecord = Record<string, any>;\n\nfunction createEqualsRecord<T extends AnyStringRecord>(keys: (keyof T)[] = []) {\n let keyMatcher: (a: T, b: T) => boolean;\n\n if (keys.length === 0) {\n keyMatcher = () => true;\n } else if (keys.length === 1) {\n const key = keys[0];\n keyMatcher = (a, b) => a[key] === b[key];\n } else {\n keyMatcher = (a, b) => {\n return keys.every((k) => a[k] === b[k]);\n };\n }\n\n return (a?: T, b?: T): boolean => {\n if (!a && !b) return true;\n if (!a || !b) return false;\n return keyMatcher(a, b);\n };\n}\n\ntype TFunction<TMap extends AnyStringRecord> = <\n TKey extends keyof TMap & string,\n>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [TMap[TKey]]\n) => string;\n\ntype SignalTFunction<TMap extends AnyStringRecord> = <\n TKey extends keyof TMap & string,\n>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [() => TMap[TKey]]\n) => Signal<string>;\n\ntype TFunctionWithSignalConstructor<\n TMap extends AnyStringRecord,\n TFN extends TFunction<TMap>,\n> = TFN & {\n asSignal: SignalTFunction<TMap>;\n};\n\nfunction addSignalFn<TMap extends AnyStringRecord, TFn extends TFunction<TMap>>(\n fn: TFn,\n store: TranslationStore,\n): TFunctionWithSignalConstructor<TMap, TFn> {\n const withSig = fn as TFunctionWithSignalConstructor<TMap, TFn>;\n\n const asSignal = <TKey extends keyof TMap & string>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [() => TMap[TKey]]\n ): Signal<string> => {\n const variables = args[0] as () => AnyStringRecord | undefined;\n const stringKey = key as string;\n\n const flatPath = replaceWithDelim(stringKey);\n\n const varsFn = variables ?? (() => undefined);\n const varsSignal = isSignal(varsFn)\n ? varsFn\n : computed(varsFn, {\n equal: createEqualsRecord(Object.keys(varsFn() ?? {})),\n });\n\n return computed(() => store.formatMessage(flatPath, varsSignal()));\n };\n\n withSig.asSignal = asSignal;\n\n return withSig;\n}\n\nexport function createT<TMap extends AnyStringRecord>(\n store: TranslationStore,\n): TFunction<TMap> {\n return <TKey extends keyof TMap & string>(\n key: TKey,\n ...args: TMap[TKey] extends void ? [] : [TMap[TKey]]\n ): string => {\n const variables = args[0] as AnyStringRecord | undefined;\n const stringKey = key as string;\n\n return store.formatMessage(replaceWithDelim(stringKey), variables);\n };\n}\n\nexport function registerNamespace<\n TDefault extends CompiledTranslation<UnknownStringKeyObject, string>,\n>(\n defaultTranslation: () => Promise<TDefault>,\n other: Record<\n string,\n () => Promise<\n CompiledTranslation<\n UnknownStringKeyObject,\n inferCompiledTranslationNamespace<TDefault>,\n string\n >\n >\n >,\n) {\n type $Map = inferCompiledTranslationMap<TDefault>;\n type $BaseTFN = TFunction<$Map>;\n type $TFN = TFunctionWithSignalConstructor<$Map, $BaseTFN>;\n\n const injectT = (): $TFN => {\n const store = inject(TranslationStore);\n\n return addSignalFn(createT(store), store);\n };\n\n let defaultTranslationLoaded = false;\n const resolver: ResolveFn<void> = async (snapshot) => {\n const store = inject(TranslationStore);\n\n const locale = injectResolveParamLocale(snapshot);\n\n const defaultLocale = injectDefaultLocale();\n const shouldPreloadDefault =\n injectIntlConfig()?.preloadDefaultLocale ?? false;\n\n const tPromise = other[locale] as (typeof other)[string] | undefined;\n\n const promise = tPromise ?? defaultTranslation;\n if (!promise && isDevMode()) {\n return console.warn(`No translation found for locale: ${locale}`);\n }\n\n if (promise === defaultTranslation && defaultTranslationLoaded) return;\n\n try {\n const promises = [promise()];\n\n if (\n shouldPreloadDefault &&\n !defaultTranslationLoaded &&\n promise !== defaultTranslation\n )\n promises.push(defaultTranslation());\n\n const translations = await Promise.allSettled(promises);\n\n const fullfilled = translations.map((t) =>\n t.status === 'fulfilled' ? t.value : null,\n );\n\n if (fullfilled.at(0) === null && fullfilled.at(1) === null)\n throw new Error('Failed to load translations');\n\n const [t, defaultT] = fullfilled;\n\n const ns = t?.namespace ?? defaultT?.namespace;\n if (!ns) throw new Error('No namespace found in translation');\n\n if (isDevMode() && t && t.locale !== locale && t.locale)\n console.warn(`Expected locale to be ${locale} but got ${t.locale}`);\n\n store.registerOnDemandLoaders(ns, {\n ...other,\n [defaultLocale]: defaultTranslation,\n });\n\n const toRegister: Record<string, Record<string, string>> = {};\n if (t) toRegister[locale] = t.flat;\n if (defaultT) toRegister[defaultLocale] = defaultT.flat;\n\n store.register(ns, toRegister);\n\n if (promise === defaultTranslation || defaultT)\n defaultTranslationLoaded = true;\n } catch {\n if (isDevMode()) {\n console.warn(`Failed to load translation for locale: ${locale}`);\n }\n } finally {\n if (locale !== untracked(store.locale)) store.locale.set(locale);\n }\n };\n\n return {\n injectNamespaceT: injectT,\n resolveNamespaceTranslation: resolver,\n };\n}\n\ntype UntypedTFunction<TNS extends string> = {\n (key: `${TNS}.${string}`, args?: Record<string, string>): string;\n asSignal: (\n key: `${TNS}.${string}`,\n args?: () => Record<string, string>,\n ) => Signal<string>;\n};\n\n/**\n * Registers a type-unsafe namespace, meant for remote loading of unknown key-value pairs using mmstack/translate infrastructure\n * The resolver & t function work the same as they would with typed namespaces, but without type safety\n */\nexport function registerRemoteNamespace<TNS extends string>(\n ns: TNS,\n defaultTranslation: () => Promise<Record<string, string>>,\n other: Record<string, () => Promise<Record<string, string>>>,\n) {\n const injectT = (): UntypedTFunction<TNS> => {\n const store = inject(TranslationStore);\n\n return addSignalFn(createT(store), store) as UntypedTFunction<TNS>;\n };\n\n let defaultTranslationLoaded = false;\n const resolver: ResolveFn<void> = async (snapshot) => {\n const store = inject(TranslationStore);\n\n const locale = injectResolveParamLocale(snapshot);\n\n const defaultLocale = injectDefaultLocale();\n const shouldPreloadDefault =\n injectIntlConfig()?.preloadDefaultLocale ?? false;\n\n const tPromise = other[locale] as (typeof other)[string] | undefined;\n\n const promise = tPromise ?? defaultTranslation;\n\n if (!promise && isDevMode()) {\n return console.warn(`No translation found for locale: ${locale}`);\n }\n\n if (promise === defaultTranslation && defaultTranslationLoaded) return;\n\n try {\n const promises = [promise()];\n\n if (\n shouldPreloadDefault &&\n !defaultTranslationLoaded &&\n promise !== defaultTranslation\n )\n promises.push(defaultTranslation());\n\n const translations = await Promise.allSettled(promises);\n\n const fullfilled = translations.map((t) =>\n t.status === 'fulfilled' ? t.value : null,\n );\n\n if (fullfilled.at(0) === null && fullfilled.at(1) === null)\n throw new Error('Failed to load translations');\n\n const [baseT, baseDefaultT] = fullfilled;\n\n const t = baseT ? compileTranslation(baseT, ns, locale) : null;\n const defaultT = baseDefaultT\n ? compileTranslation(baseDefaultT, ns, defaultLocale)\n : null;\n\n if (isDevMode() && t && t.locale !== locale && t.locale)\n console.warn(`Expected locale to be ${locale} but got ${t.locale}`);\n\n store.registerOnDemandLoaders(ns, {\n ...other,\n [defaultLocale]: defaultTranslation,\n });\n\n const toRegister: Record<string, Record<string, string>> = {};\n if (t) toRegister[locale] = t.flat;\n if (defaultT) toRegister[defaultLocale] = defaultT.flat;\n\n store.register(ns, toRegister);\n\n if (promise === defaultTranslation || defaultT)\n defaultTranslationLoaded = true;\n } catch {\n if (isDevMode()) {\n console.warn(`Failed to load translation for locale: ${locale}`);\n }\n } finally {\n if (locale !== untracked(store.locale)) store.locale.set(locale);\n }\n };\n\n return {\n injectNamespaceT: injectT,\n resolveNamespaceTranslation: resolver,\n };\n}\n","import { inject } from '@angular/core';\nimport {\n Router,\n type CanMatchFn,\n type Route,\n type UrlSegment,\n} from '@angular/router';\nimport {\n injectDefaultLocale,\n injectSupportedLocales,\n} from './translation-store';\n\n/**\n * Guard that validates the locale parameter against supported locales.\n * Redirects to default locale if the locale is invalid.\n *\n * @param prefixSegments Optional array of path segments preceding the locale segment.\n * if (you wanted to match /app/:locale/... you would pass ['app'] here) & the function would match the second parameter + redirect accordingly\n *\n * @example\n * ```typescript\n * {\n * path: ':locale',\n * canMatch: [canMatchLocale()],\n * children: [...]\n * }\n * ```\n */\nexport function canMatchLocale(prefixSegments: string[] = []): CanMatchFn {\n return (_route: Route, segments: UrlSegment[]) => {\n const supportedLocales = injectSupportedLocales();\n\n const locale = segments.at(prefixSegments.length)?.path;\n\n if (!locale || !supportedLocales.includes(locale))\n return inject(Router).createUrlTree([\n ...prefixSegments,\n injectDefaultLocale(),\n ]);\n\n return true;\n };\n}\n","import {\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n Renderer2,\n} from '@angular/core';\nimport {\n type CompiledTranslation,\n type inferCompiledTranslationMap,\n} from './compile';\nimport { createT } from './register-namespace';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport { TranslationStore } from './translation-store';\n\n@Directive()\nexport abstract class Translate<\n TInput extends string,\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>,\n TKey extends TInput & keyof TMap & string = TInput & keyof TMap & string,\n> {\n private readonly t = createT(inject(TranslationStore));\n\n readonly translate =\n input.required<\n TMap[TKey] extends void\n ? TKey | [key: TKey]\n : [key: TKey, vars: TMap[TKey]]\n >();\n\n constructor() {\n const key = computed(() => {\n const vars = this.translate();\n return (Array.isArray(vars) ? vars[0] : vars) as TKey;\n });\n\n const args = computed(\n () => {\n const vars = this.translate();\n return (Array.isArray(vars) ? vars[1] : undefined) as TMap[TKey];\n },\n {\n equal: (a, b) => {\n if (a === undefined && b === undefined) return true;\n if (a === undefined || b === undefined) return false;\n\n const aObj = a as Record<string, string>;\n const keys = Object.keys(aObj);\n const bObj = b as Record<string, string>;\n\n if (!keys.length) return !Object.keys(bObj).length;\n\n return keys.every((key) => aObj[key] === bObj[key]);\n },\n },\n );\n\n const translation = computed(() => this.t(key(), args()));\n\n const renderer = inject(Renderer2);\n const el = inject<ElementRef<HTMLElement>>(ElementRef);\n\n afterRenderEffect({\n write: () => {\n renderer.setProperty(el.nativeElement, 'textContent', translation());\n },\n });\n }\n}\n","import { ChangeDetectorRef, effect, inject } from '@angular/core';\nimport { type CompiledTranslation, type inferCompiledTranslationMap } from './compile';\nimport { createT } from './register-namespace';\nimport { type UnknownStringKeyObject } from './string-key-object.type';\nimport { TranslationStore } from './translation-store';\n\nexport abstract class Translator<\n T extends CompiledTranslation<UnknownStringKeyObject, string>,\n TMap extends inferCompiledTranslationMap<T> = inferCompiledTranslationMap<T>,\n> {\n private readonly store = inject(TranslationStore);\n private readonly t = createT<TMap>(this.store);\n\n constructor() {\n const cdr = inject(ChangeDetectorRef);\n\n effect(() => {\n this.store.locale();\n cdr.markForCheck();\n });\n }\n\n transform<K extends keyof TMap & string>(\n key: K,\n ...args: TMap[K] extends void\n ? [locale?: string]\n : [TMap[K], locale?: string]\n ): string {\n const actualArgs = args.filter(\n (a) => typeof a === 'object',\n ) as TMap[K] extends void ? [] : [TMap[K]];\n\n return this.t(key, ...actualArgs);\n }\n}\n","import { type Provider, signal } from '@angular/core';\nimport { createIntl, createIntlCache, type IntlShape } from '@formatjs/intl';\nimport { compileTranslation } from '../compile';\nimport { type UnknownStringKeyObject } from '../string-key-object.type';\nimport { TranslationStore } from '../translation-store';\n\n/**\n * Options designed to feed into the mock translations function.\n */\nexport interface MockTranslationOptions {\n /**\n * If provided, allows overriding the default behavior of simply echoing translation keys back.\n * Format: Record of namespace -> (Translation shape similar to what you pass to `createNamespace`)\n *\n * Example:\n * ```ts\n * {\n * home: { title: 'Mocked Title' },\n * auth: { error: 'Mocked Error' }\n * }\n * ```\n */\n translations?: Record<string, UnknownStringKeyObject>;\n\n /**\n * When true, uses `@formatjs/intl` to process ICU message syntax (e.g. `{name}`, plurals, selects).\n * This gives you real variable interpolation in your test assertions.\n *\n * @default false — values are ignored and the raw message string is returned.\n *\n * @example\n * ```ts\n * provideMockTranslations({\n * translations: { home: { greet: 'Hello {name}' } },\n * formatValues: true,\n * })\n * // t('home.greet', { name: 'Alice' }) → 'Hello Alice'\n * ```\n */\n formatValues?: boolean;\n\n /**\n * The locale to use when `formatValues` is true.\n * @default 'en-US'\n */\n locale?: string;\n}\n\n/**\n * Provides an isolated mock `TranslationStore` usable across testing modules that use components\n * depending on `@mmstack/translate` APIs (like `Translate` directive, `Translator` pipe, or `injectNamespaceT`).\n *\n * This provider intercepts all translation logic, bypassing chunk loaders and Intl.\n * When a custom configuration isn't provided, formatMessage simply echoes the translation key, using dots `.`.\n *\n * ### Usage\n * ```typescript\n * TestBed.configureTestingModule({\n * providers: [provideMockTranslations()]\n * });\n * ```\n */\nexport function provideMockTranslations(\n options?: MockTranslationOptions,\n): Provider[] {\n // We compile the mock strings to flat delimiters just like the internal compile module.\n const mappedMocks: Record<string, string> = {};\n\n if (options?.translations) {\n for (const [namespace, translationObj] of Object.entries(\n options.translations,\n )) {\n const compiled = compileTranslation(translationObj, namespace);\n\n for (const [key, val] of Object.entries(compiled.flat)) {\n // e.g. from 'home::MMT_DELIM::title'\n const fullKey = `${namespace}::MMT_DELIM::${key}`;\n mappedMocks[fullKey] = val;\n }\n }\n }\n\n const locale = options?.locale ?? 'en-US';\n\n let intl: IntlShape | undefined;\n\n if (options?.formatValues) {\n intl = createIntl({ locale, messages: mappedMocks }, createIntlCache());\n }\n\n return [\n {\n provide: TranslationStore,\n useValue: {\n locale: signal(locale),\n formatMessage: (\n key: string,\n values?: Record<string, string | number>,\n ) => {\n const message = mappedMocks[key];\n\n if (!message) {\n // Fallback to echoing the key back in dot notation (more readable for unit assertions).\n return key.replaceAll('::MMT_DELIM::', '.');\n }\n\n if (intl) {\n return intl.formatMessage(\n { id: key, defaultMessage: message },\n values,\n );\n }\n\n return message;\n },\n hasLocaleLoaders: () => false,\n register: () => {\n // noop\n },\n registerOnDemandLoaders: () => {\n // noop\n },\n dynamicLocaleLoader: {\n isLoading: signal(false),\n value: signal(null),\n error: signal(null),\n },\n loadQueue: signal([]),\n },\n },\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["cache","getFormatter"],"mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,eAAe;AAE3B,SAAU,YAAY,CAAC,MAAc,EAAE,GAAW,EAAA;AACtD,IAAA,OAAO,GAAG,MAAM,CAAA,EAAG,SAAS,CAAA,EAAG,GAAG,EAAE;AACtC;SAEgB,gBAAgB,CAAC,GAAW,EAAE,IAAI,GAAG,GAAG,EAAA;IACtD,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC;AACxC;;ACDA,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAyChE,SAAS,mBAAmB,CAAC,CAAU,EAAA;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;AAC5C;AAEA,SAAS,kBAAkB,CAAmC,GAAM,EAAA;AAClE,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AACpB,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,YAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;QAClB;AAAO,aAAA,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE;AACrC,YAAA,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CA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CAAC;oBAC7C;oBAEA,IAAI,IAAI,EAAE;AACR,wBAAA,OAAO,IAAI,CAAC,aAAa,CACvB,EAAE,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,EACpC,MAAM,CACP;oBACH;AAEA,oBAAA,OAAO,OAAO;gBAChB,CAAC;AACD,gBAAA,gBAAgB,EAAE,MAAM,KAAK;gBAC7B,QAAQ,EAAE,MAAK;;gBAEf,CAAC;gBACD,uBAAuB,EAAE,MAAK;;gBAE9B,CAAC;AACD,gBAAA,mBAAmB,EAAE;AACnB,oBAAA,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC;AACxB,oBAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC;AACnB,oBAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC;AACpB,iBAAA;AACD,gBAAA,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;AACtB,aAAA;AACF,SAAA;KACF;AACH;;ACnIA;;AAEG;;;;"}
|
|
@@ -367,5 +367,60 @@ declare abstract class Translator<T extends CompiledTranslation<UnknownStringKey
|
|
|
367
367
|
transform<K extends keyof TMap & string>(key: K, ...args: TMap[K] extends void ? [locale?: string] : [TMap[K], locale?: string]): string;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
|
|
370
|
+
/**
|
|
371
|
+
* Options designed to feed into the mock translations function.
|
|
372
|
+
*/
|
|
373
|
+
interface MockTranslationOptions {
|
|
374
|
+
/**
|
|
375
|
+
* If provided, allows overriding the default behavior of simply echoing translation keys back.
|
|
376
|
+
* Format: Record of namespace -> (Translation shape similar to what you pass to `createNamespace`)
|
|
377
|
+
*
|
|
378
|
+
* Example:
|
|
379
|
+
* ```ts
|
|
380
|
+
* {
|
|
381
|
+
* home: { title: 'Mocked Title' },
|
|
382
|
+
* auth: { error: 'Mocked Error' }
|
|
383
|
+
* }
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
translations?: Record<string, UnknownStringKeyObject>;
|
|
387
|
+
/**
|
|
388
|
+
* When true, uses `@formatjs/intl` to process ICU message syntax (e.g. `{name}`, plurals, selects).
|
|
389
|
+
* This gives you real variable interpolation in your test assertions.
|
|
390
|
+
*
|
|
391
|
+
* @default false — values are ignored and the raw message string is returned.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```ts
|
|
395
|
+
* provideMockTranslations({
|
|
396
|
+
* translations: { home: { greet: 'Hello {name}' } },
|
|
397
|
+
* formatValues: true,
|
|
398
|
+
* })
|
|
399
|
+
* // t('home.greet', { name: 'Alice' }) → 'Hello Alice'
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
formatValues?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* The locale to use when `formatValues` is true.
|
|
405
|
+
* @default 'en-US'
|
|
406
|
+
*/
|
|
407
|
+
locale?: string;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Provides an isolated mock `TranslationStore` usable across testing modules that use components
|
|
411
|
+
* depending on `@mmstack/translate` APIs (like `Translate` directive, `Translator` pipe, or `injectNamespaceT`).
|
|
412
|
+
*
|
|
413
|
+
* This provider intercepts all translation logic, bypassing chunk loaders and Intl.
|
|
414
|
+
* When a custom configuration isn't provided, formatMessage simply echoes the translation key, using dots `.`.
|
|
415
|
+
*
|
|
416
|
+
* ### Usage
|
|
417
|
+
* ```typescript
|
|
418
|
+
* TestBed.configureTestingModule({
|
|
419
|
+
* providers: [provideMockTranslations()]
|
|
420
|
+
* });
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
declare function provideMockTranslations(options?: MockTranslationOptions): Provider[];
|
|
424
|
+
|
|
425
|
+
export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectDynamicLocale, injectIntl, injectResolveParamLocale, injectSupportedLocales, provideIntlConfig, provideMockTranslations, registerNamespace, registerRemoteNamespace };
|
|
371
426
|
export type { CompiledTranslation, FormatCurrencyOptions, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPercentOptions, FormatRelativeTimeOptions, RelativeTimeUnit, SupportedDateInput, SupportedListInput, inferCompiledTranslationMap, inferCompiledTranslationNamespace, inferCompiledTranslationShape, mergeTranslationMaps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmstack/translate",
|
|
3
|
-
"version": "21.1.
|
|
3
|
+
"version": "21.1.7",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"angular",
|
|
6
6
|
"localize",
|
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@angular/core": ">=21 <22",
|
|
18
|
+
"@angular/router": ">=21 <22",
|
|
18
19
|
"@formatjs/intl": "~3.1.8 || ^4.0.0"
|
|
19
20
|
},
|
|
20
21
|
"homepage": "https://github.com/mihajm/mmstack/blob/master/packages/translate",
|
|
21
22
|
"sideEffects": false,
|
|
22
23
|
"module": "fesm2022/mmstack-translate.mjs",
|
|
23
|
-
"typings": "
|
|
24
|
+
"typings": "index.d.ts",
|
|
24
25
|
"exports": {
|
|
25
26
|
"./package.json": {
|
|
26
27
|
"default": "./package.json"
|
|
27
28
|
},
|
|
28
29
|
".": {
|
|
29
|
-
"types": "./
|
|
30
|
+
"types": "./index.d.ts",
|
|
30
31
|
"default": "./fesm2022/mmstack-translate.mjs"
|
|
31
32
|
}
|
|
32
33
|
},
|