intl-messageformat 10.0.1 → 10.1.0
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/lib/src/formatters.d.ts +15 -3
- package/lib/src/formatters.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/formatters.d.ts +15 -3
- package/src/formatters.d.ts.map +1 -1
package/lib/src/formatters.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
2
2
|
import { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace FormatjsIntl {
|
|
5
|
+
interface Message {
|
|
6
|
+
}
|
|
7
|
+
interface IntlConfig {
|
|
8
|
+
}
|
|
9
|
+
interface Formats {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare type Format<Source = string> = Source extends keyof FormatjsIntl.Formats ? FormatjsIntl.Formats[Source] : string;
|
|
3
14
|
export interface Formats {
|
|
4
|
-
number: Record<
|
|
5
|
-
date: Record<
|
|
6
|
-
time: Record<
|
|
15
|
+
number: Record<Format<'number'>, NumberFormatOptions>;
|
|
16
|
+
date: Record<Format<'date'>, Intl.DateTimeFormatOptions>;
|
|
17
|
+
time: Record<Format<'time'>, Intl.DateTimeFormatOptions>;
|
|
7
18
|
}
|
|
8
19
|
export interface FormatterCache {
|
|
9
20
|
number: Record<string, NumberFormatOptions>;
|
|
@@ -32,4 +43,5 @@ export declare type PrimitiveType = string | number | boolean | null | undefined
|
|
|
32
43
|
export declare function isFormatXMLElementFn<T>(el: PrimitiveType | T | FormatXMLElementFn<T>): el is FormatXMLElementFn<T>;
|
|
33
44
|
export declare function formatToParts<T>(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>, currentPluralValue?: number, originalMessage?: string): MessageFormatPart<T>[];
|
|
34
45
|
export declare type FormatXMLElementFn<T, R = string | T | Array<string | T>> = (parts: Array<string | T>) => R;
|
|
46
|
+
export {};
|
|
35
47
|
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl-messageformat/src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAWL,oBAAoB,EAGrB,MAAM,oCAAoC,CAAA;AAS3C,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl-messageformat/src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAWL,oBAAoB,EAGrB,MAAM,oCAAoC,CAAA;AAS3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,YAAY,CAAC;QACrB,UAAU,OAAO;SAAG;QACpB,UAAU,UAAU;SAAG;QACvB,UAAU,OAAO;SAAG;KACrB;CACF;AAED,aAAK,MAAM,CAAC,MAAM,GAAG,MAAM,IAAI,MAAM,SAAS,MAAM,YAAY,CAAC,OAAO,GACpE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,GAC5B,MAAM,CAAA;AAEV,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAA;IACrD,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;IACxD,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;CACzD;AAED,MAAM,WAA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AgB,aAAa,CAAC,CAAC,EAC7B,GAAG,EAAE,oBAAoB,EAAE,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAClE,kBAAkB,CAAC,EAAE,MAAM,EAE3B,eAAe,CAAC,EAAE,MAAM,GACvB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CA6LxB;AAED,oBAAY,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACtE,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KACrB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intl-messageformat",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"module": "lib/index.js",
|
|
32
32
|
"types": "index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@formatjs/ecma402-abstract": "1.11.
|
|
35
|
-
"@formatjs/fast-memoize": "1.2.
|
|
36
|
-
"@formatjs/icu-messageformat-parser": "2.1.
|
|
34
|
+
"@formatjs/ecma402-abstract": "1.11.7",
|
|
35
|
+
"@formatjs/fast-memoize": "1.2.4",
|
|
36
|
+
"@formatjs/icu-messageformat-parser": "2.1.3",
|
|
37
37
|
"tslib": "2.4.0"
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
package/src/formatters.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
2
2
|
import { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace FormatjsIntl {
|
|
5
|
+
interface Message {
|
|
6
|
+
}
|
|
7
|
+
interface IntlConfig {
|
|
8
|
+
}
|
|
9
|
+
interface Formats {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare type Format<Source = string> = Source extends keyof FormatjsIntl.Formats ? FormatjsIntl.Formats[Source] : string;
|
|
3
14
|
export interface Formats {
|
|
4
|
-
number: Record<
|
|
5
|
-
date: Record<
|
|
6
|
-
time: Record<
|
|
15
|
+
number: Record<Format<'number'>, NumberFormatOptions>;
|
|
16
|
+
date: Record<Format<'date'>, Intl.DateTimeFormatOptions>;
|
|
17
|
+
time: Record<Format<'time'>, Intl.DateTimeFormatOptions>;
|
|
7
18
|
}
|
|
8
19
|
export interface FormatterCache {
|
|
9
20
|
number: Record<string, NumberFormatOptions>;
|
|
@@ -32,4 +43,5 @@ export declare type PrimitiveType = string | number | boolean | null | undefined
|
|
|
32
43
|
export declare function isFormatXMLElementFn<T>(el: PrimitiveType | T | FormatXMLElementFn<T>): el is FormatXMLElementFn<T>;
|
|
33
44
|
export declare function formatToParts<T>(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>, currentPluralValue?: number, originalMessage?: string): MessageFormatPart<T>[];
|
|
34
45
|
export declare type FormatXMLElementFn<T, R = string | T | Array<string | T>> = (parts: Array<string | T>) => R;
|
|
46
|
+
export {};
|
|
35
47
|
//# sourceMappingURL=formatters.d.ts.map
|
package/src/formatters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-messageformat/src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,E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