@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/README.md +232 -165
- package/fesm2022/mmstack-translate.mjs +85 -22
- package/fesm2022/mmstack-translate.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/lib/format/date.d.ts +1 -1
- package/lib/format/display-name.d.ts +1 -1
- package/lib/format/list.d.ts +1 -1
- package/lib/format/numeric.d.ts +3 -3
- package/lib/format/relative-time.d.ts +1 -1
- package/lib/path-param.d.ts +4 -0
- package/lib/register-namespace.d.ts +21 -1
- package/lib/{resovler-locale.d.ts → resolver-locale.d.ts} +3 -0
- package/package.json +1 -1
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/
|
|
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';
|
package/lib/format/date.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export type FormatDateOptions = {
|
|
|
65
65
|
locale: string;
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
|
-
* @deprecated UNSAFE FOR SSR/EDGE.
|
|
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.
|
|
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 */
|
package/lib/format/list.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type FormatListOptions = {
|
|
|
22
22
|
locale: string;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
-
* @deprecated UNSAFE FOR SSR/EDGE.
|
|
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 */
|
package/lib/format/numeric.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type FormatNumberOptions = {
|
|
|
34
34
|
locale: string;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
|
-
* @deprecated UNSAFE FOR SSR/EDGE.
|
|
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.
|
|
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.
|
|
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.
|
|
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 */
|
package/lib/path-param.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
};
|