use-intl 2.11.0-alpha.2 → 2.11.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/LICENSE +21 -0
- package/README.md +32 -20
- package/dist/core/createFormatter.d.ts +17 -0
- package/dist/core/createIntl.d.ts +5 -15
- package/dist/core/index.d.ts +1 -0
- package/dist/core/use-intl.esm10.js +34 -0
- package/dist/core/use-intl.esm10.js.map +1 -0
- package/dist/core/use-intl.esm2.js +2 -2
- package/dist/core/use-intl.esm3.js +10 -10
- package/dist/core/use-intl.esm3.js.map +1 -1
- package/dist/core/use-intl.esm4.js +9 -53
- package/dist/core/use-intl.esm4.js.map +1 -1
- package/dist/core/use-intl.esm5.js +56 -12
- package/dist/core/use-intl.esm5.js.map +1 -1
- package/dist/core/use-intl.esm6.js +11 -209
- package/dist/core/use-intl.esm6.js.map +1 -1
- package/dist/core/use-intl.esm7.js +29 -7
- package/dist/core/use-intl.esm7.js.map +1 -1
- package/dist/core/use-intl.esm8.js +199 -18
- package/dist/core/use-intl.esm8.js.map +1 -1
- package/dist/core/use-intl.esm9.js +5 -29
- package/dist/core/use-intl.esm9.js.map +1 -1
- package/dist/react/IntlContext.d.ts +19 -2
- package/dist/react/IntlProvider.d.ts +16 -2
- package/dist/react/index.d.ts +2 -1
- package/dist/react/use-intl.esm.js +26 -7
- package/dist/react/use-intl.esm.js.map +1 -1
- package/dist/react/use-intl.esm10.js +2 -2
- package/dist/react/use-intl.esm2.js +20 -19
- package/dist/react/use-intl.esm2.js.map +1 -1
- package/dist/react/use-intl.esm3.js +3 -21
- package/dist/react/use-intl.esm3.js.map +1 -1
- package/dist/react/use-intl.esm4.js +45 -3
- package/dist/react/use-intl.esm4.js.map +1 -1
- package/dist/react/use-intl.esm6.js +18 -43
- package/dist/react/use-intl.esm6.js.map +1 -1
- package/dist/react/use-intl.esm7.js +30 -3
- package/dist/react/use-intl.esm7.js.map +1 -1
- package/dist/react/use-intl.esm8.js +3 -30
- package/dist/react/use-intl.esm8.js.map +1 -1
- package/dist/react/use-intl.esm9.js +1 -1
- package/dist/react/useFormatter.d.ts +5 -0
- package/dist/react/useIntl.d.ts +1 -0
- package/dist/react/useIntlContext.d.ts +1 -1
- package/dist/src/core/createBaseTranslator.js +11 -8
- package/dist/src/core/createBaseTranslator.js.map +1 -1
- package/dist/src/core/createFormatter.d.ts +17 -0
- package/dist/src/core/createFormatter.js +126 -0
- package/dist/src/core/createFormatter.js.map +1 -0
- package/dist/src/core/createIntl.d.ts +5 -15
- package/dist/src/core/createIntl.js +9 -124
- package/dist/src/core/createIntl.js.map +1 -1
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/core/index.js +2 -0
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/react/IntlContext.d.ts +19 -2
- package/dist/src/react/IntlContext.js.map +1 -1
- package/dist/src/react/IntlProvider.d.ts +16 -2
- package/dist/src/react/IntlProvider.js +13 -4
- package/dist/src/react/IntlProvider.js.map +1 -1
- package/dist/src/react/index.d.ts +2 -1
- package/dist/src/react/index.js +3 -1
- package/dist/src/react/index.js.map +1 -1
- package/dist/src/react/useFormatter.d.ts +5 -0
- package/dist/src/react/useFormatter.js +14 -0
- package/dist/src/react/useFormatter.js.map +1 -0
- package/dist/src/react/useIntl.d.ts +1 -0
- package/dist/src/react/useIntl.js +6 -0
- package/dist/src/react/useIntl.js.map +1 -1
- package/dist/src/react/useIntlContext.d.ts +1 -1
- package/dist/use-intl.cjs.development.js +99 -68
- package/dist/use-intl.cjs.development.js.map +1 -1
- package/dist/use-intl.cjs.production.min.js +1 -1
- package/dist/use-intl.cjs.production.min.js.map +1 -1
- package/dist/use-intl.esm.js +7 -5
- package/dist/use-intl.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/core/createBaseTranslator.tsx +15 -12
- package/src/core/createFormatter.tsx +181 -0
- package/src/core/createIntl.tsx +12 -180
- package/src/core/index.tsx +3 -0
- package/src/react/IntlContext.tsx +20 -2
- package/src/react/IntlProvider.tsx +36 -5
- package/src/react/index.tsx +4 -1
- package/src/react/useFormatter.tsx +19 -0
- package/src/react/useIntl.tsx +10 -0
- package/CHANGELOG.md +0 -501
- package/dist/react/IntlContextValue.d.ts +0 -19
- package/dist/react/IntlProviderProps.d.ts +0 -15
- package/dist/react/getIntlContextValue.d.ts +0 -18
- package/dist/src/react/IntlContextValue.d.ts +0 -19
- package/dist/src/react/IntlContextValue.js +0 -2
- package/dist/src/react/IntlContextValue.js.map +0 -1
- package/dist/src/react/IntlProviderProps.d.ts +0 -15
- package/dist/src/react/IntlProviderProps.js +0 -2
- package/dist/src/react/IntlProviderProps.js.map +0 -1
- package/dist/src/react/getIntlContextValue.d.ts +0 -18
- package/dist/src/react/getIntlContextValue.js +0 -21
- package/dist/src/react/getIntlContextValue.js.map +0 -1
- package/src/react/IntlContextValue.tsx +0 -21
- package/src/react/IntlProviderProps.tsx +0 -17
- package/src/react/getIntlContextValue.tsx +0 -30
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import IntlError, { IntlErrorCode } from './IntlError';
|
|
2
|
+
import { defaultOnError } from './defaults';
|
|
3
|
+
const MINUTE = 60;
|
|
4
|
+
const HOUR = MINUTE * 60;
|
|
5
|
+
const DAY = HOUR * 24;
|
|
6
|
+
const WEEK = DAY * 7;
|
|
7
|
+
const MONTH = DAY * (365 / 12); // Approximation
|
|
8
|
+
const YEAR = DAY * 365;
|
|
9
|
+
function getRelativeTimeFormatConfig(seconds) {
|
|
10
|
+
const absValue = Math.abs(seconds);
|
|
11
|
+
let value, unit;
|
|
12
|
+
// We have to round the resulting values, as `Intl.RelativeTimeFormat`
|
|
13
|
+
// will include fractions like '2.1 hours ago'.
|
|
14
|
+
if (absValue < MINUTE) {
|
|
15
|
+
unit = 'second';
|
|
16
|
+
value = Math.round(seconds);
|
|
17
|
+
}
|
|
18
|
+
else if (absValue < HOUR) {
|
|
19
|
+
unit = 'minute';
|
|
20
|
+
value = Math.round(seconds / MINUTE);
|
|
21
|
+
}
|
|
22
|
+
else if (absValue < DAY) {
|
|
23
|
+
unit = 'hour';
|
|
24
|
+
value = Math.round(seconds / HOUR);
|
|
25
|
+
}
|
|
26
|
+
else if (absValue < WEEK) {
|
|
27
|
+
unit = 'day';
|
|
28
|
+
value = Math.round(seconds / DAY);
|
|
29
|
+
}
|
|
30
|
+
else if (absValue < MONTH) {
|
|
31
|
+
unit = 'week';
|
|
32
|
+
value = Math.round(seconds / WEEK);
|
|
33
|
+
}
|
|
34
|
+
else if (absValue < YEAR) {
|
|
35
|
+
unit = 'month';
|
|
36
|
+
value = Math.round(seconds / MONTH);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
unit = 'year';
|
|
40
|
+
value = Math.round(seconds / YEAR);
|
|
41
|
+
}
|
|
42
|
+
return { value, unit };
|
|
43
|
+
}
|
|
44
|
+
export default function createFormatter({ formats, locale, now: globalNow, onError = defaultOnError, timeZone }) {
|
|
45
|
+
function resolveFormatOrOptions(typeFormats, formatOrOptions) {
|
|
46
|
+
let options;
|
|
47
|
+
if (typeof formatOrOptions === 'string') {
|
|
48
|
+
const formatName = formatOrOptions;
|
|
49
|
+
options = typeFormats?.[formatName];
|
|
50
|
+
if (!options) {
|
|
51
|
+
const error = new IntlError(IntlErrorCode.MISSING_FORMAT, process.env.NODE_ENV !== 'production'
|
|
52
|
+
? `Format \`${formatName}\` is not available. You can configure it on the provider or provide custom options.`
|
|
53
|
+
: undefined);
|
|
54
|
+
onError(error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
options = formatOrOptions;
|
|
60
|
+
}
|
|
61
|
+
return options;
|
|
62
|
+
}
|
|
63
|
+
function getFormattedValue(value, formatOrOptions, typeFormats, formatter) {
|
|
64
|
+
let options;
|
|
65
|
+
try {
|
|
66
|
+
options = resolveFormatOrOptions(typeFormats, formatOrOptions);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
return String(value);
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
return formatter(options);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
onError(new IntlError(IntlErrorCode.FORMATTING_ERROR, error.message));
|
|
76
|
+
return String(value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function dateTime(
|
|
80
|
+
/** If a number is supplied, this is interpreted as a UTC timestamp. */
|
|
81
|
+
value,
|
|
82
|
+
/** If a time zone is supplied, the `value` is converted to that time zone.
|
|
83
|
+
* Otherwise the user time zone will be used. */
|
|
84
|
+
formatOrOptions) {
|
|
85
|
+
return getFormattedValue(value, formatOrOptions, formats?.dateTime, (options) => {
|
|
86
|
+
if (timeZone && !options?.timeZone) {
|
|
87
|
+
options = { ...options, timeZone };
|
|
88
|
+
}
|
|
89
|
+
return new Intl.DateTimeFormat(locale, options).format(value);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function number(value, formatOrOptions) {
|
|
93
|
+
return getFormattedValue(value, formatOrOptions, formats?.number, (options) => new Intl.NumberFormat(locale, options).format(value));
|
|
94
|
+
}
|
|
95
|
+
function relativeTime(
|
|
96
|
+
/** The date time that needs to be formatted. */
|
|
97
|
+
date,
|
|
98
|
+
/** The reference point in time to which `date` will be formatted in relation to. */
|
|
99
|
+
now) {
|
|
100
|
+
try {
|
|
101
|
+
if (!now) {
|
|
102
|
+
if (globalNow) {
|
|
103
|
+
now = globalNow;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
throw new Error(process.env.NODE_ENV !== 'production'
|
|
107
|
+
? `The \`now\` parameter wasn't provided and there was no global fallback configured on the provider.`
|
|
108
|
+
: undefined);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const dateDate = date instanceof Date ? date : new Date(date);
|
|
112
|
+
const nowDate = now instanceof Date ? now : new Date(now);
|
|
113
|
+
const seconds = (dateDate.getTime() - nowDate.getTime()) / 1000;
|
|
114
|
+
const { unit, value } = getRelativeTimeFormatConfig(seconds);
|
|
115
|
+
return new Intl.RelativeTimeFormat(locale, {
|
|
116
|
+
numeric: 'auto'
|
|
117
|
+
}).format(value, unit);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
onError(new IntlError(IntlErrorCode.FORMATTING_ERROR, error.message));
|
|
121
|
+
return String(date);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { dateTime, number, relativeTime };
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=createFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFormatter.js","sourceRoot":"","sources":["../../../src/core/createFormatter.tsx"],"names":[],"mappings":"AAEA,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAErD,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,CAAC;AACzB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AACtB,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AACrB,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,gBAAgB;AAChD,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAEvB,SAAS,2BAA2B,CAAC,OAAe;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,EAAE,IAAiC,CAAC;IAE7C,sEAAsE;IACtE,+CAA+C;IAE/C,IAAI,QAAQ,GAAG,MAAM,EAAE;QACrB,IAAI,GAAG,QAAQ,CAAC;QAChB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC7B;SAAM,IAAI,QAAQ,GAAG,IAAI,EAAE;QAC1B,IAAI,GAAG,QAAQ,CAAC;QAChB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,OAAO,CAAC,CACxE,CAAC;YACF,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;SACrB;IACH,CAAC;IAED,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
locale: string;
|
|
7
|
-
timeZone?: string;
|
|
8
|
-
onError?(error: IntlError): void;
|
|
9
|
-
formats?: Partial<Formats>;
|
|
10
|
-
now?: Date;
|
|
11
|
-
};
|
|
12
|
-
export default function createIntl({ formats, locale, now: globalNow, onError, timeZone }: Props): {
|
|
13
|
-
formatDateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions | undefined) => string;
|
|
14
|
-
formatNumber: (value: number, formatOrOptions?: string | NumberFormatOptions | undefined) => string;
|
|
1
|
+
import createFormatter from './createFormatter';
|
|
2
|
+
/** @deprecated Switch to `createFormatter` */
|
|
3
|
+
export default function createIntl(...args: Parameters<typeof createFormatter>): {
|
|
4
|
+
formatDateTime: (value: number | Date, formatOrOptions?: string | import("./DateTimeFormatOptions").default | undefined) => string;
|
|
5
|
+
formatNumber: (value: number, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
15
6
|
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
16
7
|
};
|
|
17
|
-
export {};
|
|
@@ -1,126 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const absValue = Math.abs(seconds);
|
|
11
|
-
let value, unit;
|
|
12
|
-
// We have to round the resulting values, as `Intl.RelativeTimeFormat`
|
|
13
|
-
// will include fractions like '2.1 hours ago'.
|
|
14
|
-
if (absValue < MINUTE) {
|
|
15
|
-
unit = 'second';
|
|
16
|
-
value = Math.round(seconds);
|
|
17
|
-
}
|
|
18
|
-
else if (absValue < HOUR) {
|
|
19
|
-
unit = 'minute';
|
|
20
|
-
value = Math.round(seconds / MINUTE);
|
|
21
|
-
}
|
|
22
|
-
else if (absValue < DAY) {
|
|
23
|
-
unit = 'hour';
|
|
24
|
-
value = Math.round(seconds / HOUR);
|
|
25
|
-
}
|
|
26
|
-
else if (absValue < WEEK) {
|
|
27
|
-
unit = 'day';
|
|
28
|
-
value = Math.round(seconds / DAY);
|
|
29
|
-
}
|
|
30
|
-
else if (absValue < MONTH) {
|
|
31
|
-
unit = 'week';
|
|
32
|
-
value = Math.round(seconds / WEEK);
|
|
33
|
-
}
|
|
34
|
-
else if (absValue < YEAR) {
|
|
35
|
-
unit = 'month';
|
|
36
|
-
value = Math.round(seconds / MONTH);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
unit = 'year';
|
|
40
|
-
value = Math.round(seconds / YEAR);
|
|
41
|
-
}
|
|
42
|
-
return { value, unit };
|
|
43
|
-
}
|
|
44
|
-
export default function createIntl({ formats, locale, now: globalNow, onError = defaultOnError, timeZone }) {
|
|
45
|
-
function resolveFormatOrOptions(typeFormats, formatOrOptions) {
|
|
46
|
-
let options;
|
|
47
|
-
if (typeof formatOrOptions === 'string') {
|
|
48
|
-
const formatName = formatOrOptions;
|
|
49
|
-
options = typeFormats?.[formatName];
|
|
50
|
-
if (!options) {
|
|
51
|
-
const error = new IntlError(IntlErrorCode.MISSING_FORMAT, process.env.NODE_ENV !== 'production'
|
|
52
|
-
? `Format \`${formatName}\` is not available. You can configure it on the provider or provide custom options.`
|
|
53
|
-
: undefined);
|
|
54
|
-
onError(error);
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
options = formatOrOptions;
|
|
60
|
-
}
|
|
61
|
-
return options;
|
|
62
|
-
}
|
|
63
|
-
function getFormattedValue(value, formatOrOptions, typeFormats, formatter) {
|
|
64
|
-
let options;
|
|
65
|
-
try {
|
|
66
|
-
options = resolveFormatOrOptions(typeFormats, formatOrOptions);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
return String(value);
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
return formatter(options);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
onError(new IntlError(IntlErrorCode.FORMATTING_ERROR, error.message));
|
|
76
|
-
return String(value);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function formatDateTime(
|
|
80
|
-
/** If a number is supplied, this is interpreted as a UTC timestamp. */
|
|
81
|
-
value,
|
|
82
|
-
/** If a time zone is supplied, the `value` is converted to that time zone.
|
|
83
|
-
* Otherwise the user time zone will be used. */
|
|
84
|
-
formatOrOptions) {
|
|
85
|
-
return getFormattedValue(value, formatOrOptions, formats?.dateTime, (options) => {
|
|
86
|
-
if (timeZone && !options?.timeZone) {
|
|
87
|
-
options = { ...options, timeZone };
|
|
88
|
-
}
|
|
89
|
-
return new Intl.DateTimeFormat(locale, options).format(value);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function formatNumber(value, formatOrOptions) {
|
|
93
|
-
return getFormattedValue(value, formatOrOptions, formats?.number, (options) => new Intl.NumberFormat(locale, options).format(value));
|
|
94
|
-
}
|
|
95
|
-
function formatRelativeTime(
|
|
96
|
-
/** The date time that needs to be formatted. */
|
|
97
|
-
date,
|
|
98
|
-
/** The reference point in time to which `date` will be formatted in relation to. */
|
|
99
|
-
now) {
|
|
100
|
-
try {
|
|
101
|
-
if (!now) {
|
|
102
|
-
if (globalNow) {
|
|
103
|
-
now = globalNow;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
throw new Error(process.env.NODE_ENV !== 'production'
|
|
107
|
-
? `The \`now\` parameter wasn't provided to \`formatRelativeTime\` and there was no global fallback configured on the provider.`
|
|
108
|
-
: undefined);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const dateDate = date instanceof Date ? date : new Date(date);
|
|
112
|
-
const nowDate = now instanceof Date ? now : new Date(now);
|
|
113
|
-
const seconds = (dateDate.getTime() - nowDate.getTime()) / 1000;
|
|
114
|
-
const { unit, value } = getRelativeTimeFormatConfig(seconds);
|
|
115
|
-
return new Intl.RelativeTimeFormat(locale, {
|
|
116
|
-
numeric: 'auto'
|
|
117
|
-
}).format(value, unit);
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
onError(new IntlError(IntlErrorCode.FORMATTING_ERROR, error.message));
|
|
121
|
-
return String(date);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return { formatDateTime, formatNumber, formatRelativeTime };
|
|
1
|
+
import createFormatter from './createFormatter';
|
|
2
|
+
/** @deprecated Switch to `createFormatter` */
|
|
3
|
+
export default function createIntl(...args) {
|
|
4
|
+
const formatter = createFormatter(...args);
|
|
5
|
+
return {
|
|
6
|
+
formatDateTime: formatter.dateTime,
|
|
7
|
+
formatNumber: formatter.number,
|
|
8
|
+
formatRelativeTime: formatter.relativeTime
|
|
9
|
+
};
|
|
125
10
|
}
|
|
126
11
|
//# sourceMappingURL=createIntl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIntl.js","sourceRoot":"","sources":["../../../src/core/createIntl.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createIntl.js","sourceRoot":"","sources":["../../../src/core/createIntl.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,8CAA8C;AAC9C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,GAAG,IAAwC;IAE3C,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3C,OAAO;QACL,cAAc,EAAE,SAAS,CAAC,QAAQ;QAClC,YAAY,EAAE,SAAS,CAAC,MAAM;QAC9B,kBAAkB,EAAE,SAAS,CAAC,YAAY;KAC3C,CAAC;AACJ,CAAC"}
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { default as DateTimeFormatOptions } from './DateTimeFormatOptions';
|
|
|
5
5
|
export { default as NumberFormatOptions } from './NumberFormatOptions';
|
|
6
6
|
export { default as IntlError, IntlErrorCode } from './IntlError';
|
|
7
7
|
export { default as createTranslator } from './createTranslator';
|
|
8
|
+
export { default as createFormatter } from './createFormatter';
|
|
8
9
|
export { default as createIntl } from './createIntl';
|
package/dist/src/core/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as IntlError, IntlErrorCode } from './IntlError';
|
|
2
2
|
export { default as createTranslator } from './createTranslator';
|
|
3
|
+
export { default as createFormatter } from './createFormatter';
|
|
4
|
+
// TODO: Remove in next major version
|
|
3
5
|
export { default as createIntl } from './createIntl';
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAChE,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAChE,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAE7D,qCAAqC;AACrC,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import AbstractIntlMessages from '../core/AbstractIntlMessages';
|
|
3
|
+
import Formats from '../core/Formats';
|
|
4
|
+
import IntlError from '../core/IntlError';
|
|
5
|
+
import { RichTranslationValues } from '../core/TranslationValues';
|
|
6
|
+
export declare type IntlContextShape = {
|
|
7
|
+
messages?: AbstractIntlMessages;
|
|
8
|
+
locale: string;
|
|
9
|
+
formats?: Partial<Formats>;
|
|
10
|
+
timeZone?: string;
|
|
11
|
+
onError(error: IntlError): void;
|
|
12
|
+
getMessageFallback(info: {
|
|
13
|
+
error: IntlError;
|
|
14
|
+
key: string;
|
|
15
|
+
namespace?: string;
|
|
16
|
+
}): string;
|
|
17
|
+
now?: Date;
|
|
18
|
+
defaultTranslationValues?: RichTranslationValues;
|
|
19
|
+
};
|
|
20
|
+
declare const IntlContext: import("react").Context<IntlContextShape | undefined>;
|
|
4
21
|
export default IntlContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlContext.js","sourceRoot":"","sources":["../../../src/react/IntlContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"IntlContext.js","sourceRoot":"","sources":["../../../src/react/IntlContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAqBpC,MAAM,WAAW,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE3E,eAAe,WAAW,CAAC"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AbstractIntlMessages } from '../core';
|
|
3
|
+
import IntlConfiguration from '../core/IntlConfiguration';
|
|
4
|
+
import { RichTranslationValues } from '../core/TranslationValues';
|
|
5
|
+
declare type Props = IntlConfiguration & {
|
|
6
|
+
/** All components that use the provided hooks should be within this tree. */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Global default values for translation values and rich text elements.
|
|
9
|
+
* Can be used for consistent usage or styling of rich text elements.
|
|
10
|
+
* Defaults will be overidden by locally provided values. */
|
|
11
|
+
defaultTranslationValues?: RichTranslationValues;
|
|
12
|
+
/** All messages that will be available in your components. */
|
|
13
|
+
messages?: AbstractIntlMessages;
|
|
14
|
+
};
|
|
15
|
+
export default function IntlProvider({ children, onError, getMessageFallback, messages, ...contextValues }: Props): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { defaultGetMessageFallback, defaultOnError } from '../core/defaults';
|
|
3
|
+
import validateMessages from '../core/validateMessages';
|
|
2
4
|
import IntlContext from './IntlContext';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
export default function IntlProvider({ children, onError = defaultOnError, getMessageFallback = defaultGetMessageFallback, messages, ...contextValues }) {
|
|
6
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (messages) {
|
|
10
|
+
validateMessages(messages, onError);
|
|
11
|
+
}
|
|
12
|
+
}, [messages, onError]);
|
|
13
|
+
}
|
|
14
|
+
return (React.createElement(IntlContext.Provider, { value: { ...contextValues, messages, onError, getMessageFallback } }, children));
|
|
6
15
|
}
|
|
7
16
|
//# sourceMappingURL=IntlProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlProvider.js","sourceRoot":"","sources":["../../../src/react/IntlProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"IntlProvider.js","sourceRoot":"","sources":["../../../src/react/IntlProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,SAAS,EAAC,MAAM,OAAO,CAAC;AAIlD,OAAO,EAAC,yBAAyB,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3E,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,WAAW,MAAM,eAAe,CAAC;AAaxC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,OAAO,GAAG,cAAc,EACxB,kBAAkB,GAAG,yBAAyB,EAC9C,QAAQ,EACR,GAAG,aAAa,EACV;IACN,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,sDAAsD;QACtD,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,QAAQ,EAAE;gBACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACrC;QACH,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;KACzB;IAED,OAAO,CACL,oBAAC,WAAW,CAAC,QAAQ,IACnB,KAAK,EAAE,EAAC,GAAG,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAC,IAE/D,QAAQ,CACY,CACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as IntlProvider } from './IntlProvider';
|
|
2
2
|
export { default as useTranslations } from './useTranslations';
|
|
3
|
-
export { default as useIntl } from './useIntl';
|
|
4
3
|
export { default as useLocale } from './useLocale';
|
|
5
4
|
export { default as useNow } from './useNow';
|
|
6
5
|
export { default as useTimeZone } from './useTimeZone';
|
|
6
|
+
export { default as useFormatter } from './useFormatter';
|
|
7
|
+
export { default as useIntl } from './useIntl';
|
package/dist/src/react/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { default as IntlProvider } from './IntlProvider';
|
|
2
2
|
export { default as useTranslations } from './useTranslations';
|
|
3
|
-
export { default as useIntl } from './useIntl';
|
|
4
3
|
export { default as useLocale } from './useLocale';
|
|
5
4
|
export { default as useNow } from './useNow';
|
|
6
5
|
export { default as useTimeZone } from './useTimeZone';
|
|
6
|
+
export { default as useFormatter } from './useFormatter';
|
|
7
|
+
// TODO: Remove in next major version
|
|
8
|
+
export { default as useIntl } from './useIntl';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAC,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAEvD,qCAAqC;AACrC,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export default function useFormatter(): {
|
|
2
|
+
dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
|
+
number: (value: number, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
4
|
+
relativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
5
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import createFormatter from '../core/createFormatter';
|
|
3
|
+
import useIntlContext from './useIntlContext';
|
|
4
|
+
export default function useFormatter() {
|
|
5
|
+
const { formats, locale, now: globalNow, onError, timeZone } = useIntlContext();
|
|
6
|
+
return useMemo(() => createFormatter({
|
|
7
|
+
formats,
|
|
8
|
+
locale,
|
|
9
|
+
now: globalNow,
|
|
10
|
+
onError,
|
|
11
|
+
timeZone
|
|
12
|
+
}), [formats, globalNow, locale, onError, timeZone]);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=useFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormatter.js","sourceRoot":"","sources":["../../../src/react/useFormatter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,YAAY;IAClC,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,cAAc,EAAE,CAAC;IAE9E,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,eAAe,CAAC;QACd,OAAO;QACP,MAAM;QACN,GAAG,EAAE,SAAS;QACd,OAAO;QACP,QAAQ;KACT,CAAC,EACJ,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @deprecated Switch to `useFormatter` */
|
|
1
2
|
export default function useIntl(): {
|
|
2
3
|
formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
4
|
formatNumber: (value: number, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import createIntl from '../core/createIntl';
|
|
3
3
|
import useIntlContext from './useIntlContext';
|
|
4
|
+
let hasWarned = false;
|
|
5
|
+
/** @deprecated Switch to `useFormatter` */
|
|
4
6
|
export default function useIntl() {
|
|
5
7
|
const { formats, locale, now: globalNow, onError, timeZone } = useIntlContext();
|
|
8
|
+
if (!hasWarned) {
|
|
9
|
+
hasWarned = true;
|
|
10
|
+
console.warn('`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.');
|
|
11
|
+
}
|
|
6
12
|
return useMemo(() => createIntl({
|
|
7
13
|
formats,
|
|
8
14
|
locale,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.js","sourceRoot":"","sources":["../../../src/react/useIntl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,cAAc,EAAE,CAAC;IAE9E,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,UAAU,CAAC;QACT,OAAO;QACP,MAAM;QACN,GAAG,EAAE,SAAS;QACd,OAAO;QACP,QAAQ;KACT,CAAC,EACJ,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAChD,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"useIntl.js","sourceRoot":"","sources":["../../../src/react/useIntl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,4CAA4C;AAC5C,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,cAAc,EAAE,CAAC;IAE9E,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,IAAI,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,6GAA6G,CAC9G,CAAC;KACH;IAED,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,UAAU,CAAC;QACT,OAAO;QACP,MAAM;QACN,GAAG,EAAE,SAAS;QACd,OAAO;QACP,QAAQ;KACT,CAAC,EACJ,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useIntlContext(): import("./
|
|
1
|
+
export default function useIntlContext(): import("./IntlContext").IntlContextShape;
|