@mmstack/translate 21.1.14 → 21.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmstack/translate",
3
- "version": "21.1.14",
3
+ "version": "21.1.15",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "localize",
@@ -157,7 +157,7 @@ type FormatDateOptions = {
157
157
  locale: string;
158
158
  };
159
159
  /**
160
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
160
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
161
161
  */
162
162
  type UnsafeFormatDateOptions = Omit<FormatDateOptions, 'locale'> & {
163
163
  /** Optional locale string falling back to the legacy global signal */
@@ -203,7 +203,7 @@ type FormatDisplayNameOptions = {
203
203
  locale: string;
204
204
  };
205
205
  /**
206
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
206
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
207
207
  */
208
208
  type UnsafeFormatDisplayNameOptions = Omit<FormatDisplayNameOptions, 'locale'> & {
209
209
  /** Optional locale string falling back to the legacy global signal */
@@ -258,7 +258,7 @@ type FormatListOptions = {
258
258
  locale: string;
259
259
  };
260
260
  /**
261
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
261
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
262
262
  */
263
263
  type UnsafeFormatListOptions = Omit<FormatListOptions, 'locale'> & {
264
264
  /** Optional locale string falling back to the legacy global signal */
@@ -324,7 +324,7 @@ type FormatNumberOptions = {
324
324
  locale: string;
325
325
  };
326
326
  /**
327
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
327
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
328
328
  */
329
329
  type UnsafeFormatNumberOptions = Omit<FormatNumberOptions, 'locale'> & {
330
330
  /** Optional locale string falling back to the legacy global signal */
@@ -377,7 +377,7 @@ type FormatPercentOptions = {
377
377
  locale: string;
378
378
  };
379
379
  /**
380
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
380
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
381
381
  */
382
382
  type UnsafeFormatPercentOptions = Omit<FormatPercentOptions, 'locale'> & {
383
383
  /** Optional locale string falling back to the legacy global signal */
@@ -425,7 +425,7 @@ type FormatCurrencyOptions = {
425
425
  locale: string;
426
426
  };
427
427
  /**
428
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
428
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
429
429
  */
430
430
  type UnsafeFormatCurrencyOptions = Omit<FormatCurrencyOptions, 'locale'> & {
431
431
  /** Optional locale string falling back to the legacy global signal */
@@ -478,7 +478,7 @@ type FormatRelativeTimeOptions = {
478
478
  locale: string;
479
479
  };
480
480
  /**
481
- * @deprecated UNSAFE FOR SSR/EDGE. Omiting the locale property forces a fallback to a process-level global singleton.
481
+ * @deprecated UNSAFE FOR SSR/EDGE. Omitting the locale property forces a fallback to a process-level global singleton.
482
482
  */
483
483
  type UnsafeFormatRelativeTimeOptions = Omit<FormatRelativeTimeOptions, 'locale'> & {
484
484
  /** Optional locale string falling back to the legacy global signal */
@@ -555,6 +555,7 @@ type DynamicConfig = BaseConfig & {
555
555
  };
556
556
  type Config = RouteBasedConfig | DynamicConfig;
557
557
  declare function provideIntlConfig(config: Config): Provider[];
558
+ declare function injectDefaultLocale(): string;
558
559
  declare function injectSupportedLocales(): string[];
559
560
  declare function injectIntl(): Signal<_formatjs_intl.IntlShape<string>>;
560
561
  /**
@@ -603,7 +604,18 @@ type SignalTFunction<TMap extends AnyStringRecord> = <TKey extends keyof TMap &
603
604
  type TFunctionWithSignalConstructor<TMap extends AnyStringRecord, TFN extends TFunction<TMap>> = TFN & {
604
605
  asSignal: SignalTFunction<TMap>;
605
606
  };
606
- declare function registerNamespace<TDefault extends CompiledTranslation<UnknownStringKeyObject, string>>(defaultTranslation: () => Promise<TDefault>, other: Record<string, () => Promise<CompiledTranslation<UnknownStringKeyObject, inferCompiledTranslationNamespace<TDefault>, string>>>): {
607
+ /**
608
+ * Shape accepted by a namespace loader: a direct `CompiledTranslation`, or an
609
+ * ES-module-style object exposing one as `default` or `translation`. Lets
610
+ * callers write `() => import('./quote.namespace')` instead of the more
611
+ * verbose `() => import('./quote.namespace').then((m) => m.default)`.
612
+ */
613
+ type LoadedTranslation<T extends CompiledTranslation<UnknownStringKeyObject, string>> = T | {
614
+ default: T;
615
+ } | {
616
+ translation: T;
617
+ };
618
+ declare function registerNamespace<TDefault extends CompiledTranslation<UnknownStringKeyObject, string>>(defaultTranslation: () => Promise<LoadedTranslation<TDefault>>, other: Record<string, () => Promise<LoadedTranslation<CompiledTranslation<UnknownStringKeyObject, inferCompiledTranslationNamespace<TDefault>, string>>>>): {
607
619
  injectNamespaceT: () => TFunctionWithSignalConstructor<inferCompiledTranslationMap<TDefault>, TFunction<inferCompiledTranslationMap<TDefault>>>;
608
620
  resolveNamespaceTranslation: ResolveFn<void>;
609
621
  };
@@ -637,6 +649,9 @@ declare function injectUnsafeT(): {
637
649
  asSignal(key: string, params?: () => Record<string, string | number>): Signal<string>;
638
650
  };
639
651
 
652
+ /**
653
+ * @internal
654
+ */
640
655
  declare function injectResolveParamLocale(snapshot: ActivatedRouteSnapshot): string;
641
656
 
642
657
  /**
@@ -751,5 +766,5 @@ declare abstract class Translator<T extends CompiledTranslation<UnknownStringKey
751
766
  */
752
767
  declare function withParams<const P extends Record<string, unknown>, const S extends string = string>(message: S): WithParams<P, S>;
753
768
 
754
- export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectAddTranslations, injectDynamicLocale, injectFormatCurrency, injectFormatDate, injectFormatDisplayName, injectFormatList, injectFormatNumber, injectFormatPercent, injectFormatRelativeTime, injectFormatters, injectIntl, injectResolveParamLocale, injectSupportedLocales, injectUnsafeT, provideFormatCurrencyDefaults, provideFormatDateDefaults, provideFormatDefaults, provideFormatDisplayNameDefaults, provideFormatListDefaults, provideFormatNumberDefaults, provideFormatPercentDefaults, provideFormatRelativeTimeDefaults, provideIntlConfig, provideMockTranslations, registerNamespace, registerRemoteNamespace, withParams };
769
+ export { Translate, Translator, canMatchLocale, compileTranslation, createNamespace, formatCurrency, formatDate, formatDisplayName, formatList, formatNumber, formatPercent, formatRelativeTime, injectAddTranslations, injectDefaultLocale, injectDynamicLocale, injectFormatCurrency, injectFormatDate, injectFormatDisplayName, injectFormatList, injectFormatNumber, injectFormatPercent, injectFormatRelativeTime, injectFormatters, injectIntl, injectResolveParamLocale, injectSupportedLocales, injectUnsafeT, provideFormatCurrencyDefaults, provideFormatDateDefaults, provideFormatDefaults, provideFormatDisplayNameDefaults, provideFormatListDefaults, provideFormatNumberDefaults, provideFormatPercentDefaults, provideFormatRelativeTimeDefaults, provideIntlConfig, provideMockTranslations, registerNamespace, registerRemoteNamespace, withParams };
755
770
  export type { CompiledTranslation, FormatCurrencyOptions, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPercentOptions, FormatRelativeTimeOptions, RelativeTimeUnit, SupportedDateInput, SupportedListInput, UnsafeFormatCurrencyOptions, UnsafeFormatDateOptions, UnsafeFormatDisplayNameOptions, UnsafeFormatListOptions, UnsafeFormatNumberOptions, UnsafeFormatPercentOptions, UnsafeFormatRelativeTimeOptions, inferCompiledTranslationMap, inferCompiledTranslationNamespace, inferCompiledTranslationShape, mergeTranslationMaps };