@mmstack/translate 19.3.7 → 19.3.8

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/index.d.ts CHANGED
@@ -2,10 +2,10 @@ export * from './lib/compile';
2
2
  export { createNamespace } from './lib/create-namespace';
3
3
  export * from './lib/format';
4
4
  export { injectUnsafeT, registerNamespace, registerRemoteNamespace, } from './lib/register-namespace';
5
- export { injectResolveParamLocale } from './lib/resovler-locale';
5
+ export { injectResolveParamLocale } from './lib/resolver-locale';
6
6
  export * from './lib/route-helpers';
7
7
  export { provideMockTranslations } from './lib/testing/provide-mock-translations';
8
8
  export { Translate } from './lib/translate';
9
- export { injectAddTranslations, injectDynamicLocale, injectIntl, injectSupportedLocales, provideIntlConfig, } from './lib/translation-store';
9
+ export { injectAddTranslations, injectDefaultLocale, injectDynamicLocale, injectIntl, injectSupportedLocales, provideIntlConfig, } from './lib/translation-store';
10
10
  export { Translator } from './lib/translator';
11
11
  export { withParams } from './lib/with-params';
@@ -65,7 +65,7 @@ export type FormatDateOptions = {
65
65
  locale: string;
66
66
  };
67
67
  /**
68
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
68
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
69
69
  */
70
70
  export type UnsafeFormatDateOptions = Omit<FormatDateOptions, 'locale'> & {
71
71
  /** Optional locale string falling back to the legacy global signal */
@@ -14,7 +14,7 @@ export type FormatDisplayNameOptions = {
14
14
  locale: string;
15
15
  };
16
16
  /**
17
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
17
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
18
18
  */
19
19
  export type UnsafeFormatDisplayNameOptions = Omit<FormatDisplayNameOptions, 'locale'> & {
20
20
  /** Optional locale string falling back to the legacy global signal */
@@ -22,7 +22,7 @@ export type FormatListOptions = {
22
22
  locale: string;
23
23
  };
24
24
  /**
25
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
25
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
26
26
  */
27
27
  export type UnsafeFormatListOptions = Omit<FormatListOptions, 'locale'> & {
28
28
  /** Optional locale string falling back to the legacy global signal */
@@ -34,7 +34,7 @@ export type FormatNumberOptions = {
34
34
  locale: string;
35
35
  };
36
36
  /**
37
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
37
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
38
38
  */
39
39
  export type UnsafeFormatNumberOptions = Omit<FormatNumberOptions, 'locale'> & {
40
40
  /** Optional locale string falling back to the legacy global signal */
@@ -91,7 +91,7 @@ export type FormatPercentOptions = {
91
91
  locale: string;
92
92
  };
93
93
  /**
94
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
94
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
95
95
  */
96
96
  export type UnsafeFormatPercentOptions = Omit<FormatPercentOptions, 'locale'> & {
97
97
  /** Optional locale string falling back to the legacy global signal */
@@ -143,7 +143,7 @@ export type FormatCurrencyOptions = {
143
143
  locale: string;
144
144
  };
145
145
  /**
146
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
146
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
147
147
  */
148
148
  export type UnsafeFormatCurrencyOptions = Omit<FormatCurrencyOptions, 'locale'> & {
149
149
  /** Optional locale string falling back to the legacy global signal */
@@ -19,7 +19,7 @@ export type FormatRelativeTimeOptions = {
19
19
  locale: string;
20
20
  };
21
21
  /**
22
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
22
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
23
23
  */
24
24
  export type UnsafeFormatRelativeTimeOptions = Omit<FormatRelativeTimeOptions, 'locale'> & {
25
25
  /** Optional locale string falling back to the legacy global signal */
@@ -1,3 +1,7 @@
1
1
  import { type Signal } from '@angular/core';
2
2
  import { ActivatedRoute } from '@angular/router';
3
+ /**
4
+ * Dynamic path parameter signal, that allows resolution even when paramsInheritenceStrategy isnt always
5
+ * This helper depends on an internal
6
+ */
3
7
  export declare function pathParam(key: string | (() => string), route?: ActivatedRoute): Signal<string | null>;
@@ -11,7 +11,27 @@ type TFunctionWithSignalConstructor<TMap extends AnyStringRecord, TFN extends TF
11
11
  };
12
12
  export declare function addSignalFn<TMap extends AnyStringRecord, TFn extends TFunction<TMap>>(fn: TFn, store: TranslationStore, keyMap: Map<string, string>): TFunctionWithSignalConstructor<TMap, TFn>;
13
13
  export declare function createT<TMap extends AnyStringRecord>(store: TranslationStore, keyMap?: Map<string, string>): TFunction<TMap>;
14
- export declare function registerNamespace<TDefault extends CompiledTranslation<UnknownStringKeyObject, string>>(defaultTranslation: () => Promise<TDefault>, other: Record<string, () => Promise<CompiledTranslation<UnknownStringKeyObject, inferCompiledTranslationNamespace<TDefault>, string>>>): {
14
+ /**
15
+ * Shape accepted by a namespace loader: a direct `CompiledTranslation`, or an
16
+ * ES-module-style object exposing one as `default` or `translation`. Lets
17
+ * callers write `() => import('./quote.namespace')` instead of the more
18
+ * verbose `() => import('./quote.namespace').then((m) => m.default)`.
19
+ */
20
+ export type LoadedTranslation<T extends CompiledTranslation<UnknownStringKeyObject, string>> = T | {
21
+ default: T;
22
+ } | {
23
+ translation: T;
24
+ };
25
+ /**
26
+ * @internal exported for unit testing
27
+ *
28
+ * Unwraps a loader result to a `CompiledTranslation`. Detection order:
29
+ * 1. value is already a `CompiledTranslation` (has `flat` + `namespace`)
30
+ * 2. value has a `default` export holding a `CompiledTranslation` (ESM default)
31
+ * 3. value has a `translation` export holding a `CompiledTranslation` (named export)
32
+ */
33
+ export declare function resolveTranslationModule<T extends CompiledTranslation<UnknownStringKeyObject, string>>(loaded: LoadedTranslation<T>): T;
34
+ export declare function registerNamespace<TDefault extends CompiledTranslation<UnknownStringKeyObject, string>>(defaultTranslation: () => Promise<LoadedTranslation<TDefault>>, other: Record<string, () => Promise<LoadedTranslation<CompiledTranslation<UnknownStringKeyObject, inferCompiledTranslationNamespace<TDefault>, string>>>>): {
15
35
  injectNamespaceT: () => TFunctionWithSignalConstructor<inferCompiledTranslationMap<TDefault>, TFunction<inferCompiledTranslationMap<TDefault>>>;
16
36
  resolveNamespaceTranslation: ResolveFn<void>;
17
37
  };
@@ -1,2 +1,5 @@
1
1
  import { ActivatedRouteSnapshot } from '@angular/router';
2
+ /**
3
+ * @internal
4
+ */
2
5
  export declare function injectResolveParamLocale(snapshot: ActivatedRouteSnapshot): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmstack/translate",
3
- "version": "19.3.7",
3
+ "version": "19.3.8",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "localize",