use-intl 3.0.0-beta.1 → 3.0.0-beta.2
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/dist/core/MessageFormatCache.d.ts +5 -0
- package/dist/core/convertFormatsToIntlMessageFormat.esm.js +7 -2
- package/dist/core/convertFormatsToIntlMessageFormat.esm.js.map +1 -1
- package/dist/core/createBaseTranslator.d.ts +2 -2
- package/dist/core/createBaseTranslator.esm.js +21 -12
- package/dist/core/createBaseTranslator.esm.js.map +1 -1
- package/dist/core/use-intl.esm.js +30 -34
- package/dist/core/use-intl.esm.js.map +1 -1
- package/dist/core/use-intl.esm10.js +1 -1
- package/dist/core/use-intl.esm2.js +206 -29
- package/dist/core/use-intl.esm2.js.map +1 -1
- package/dist/core/use-intl.esm3.js +33 -10
- package/dist/core/use-intl.esm3.js.map +1 -1
- package/dist/core/use-intl.esm4.js +9 -196
- package/dist/core/use-intl.esm4.js.map +1 -1
- package/dist/core/use-intl.esm5.js +1 -1
- package/dist/core/use-intl.esm6.js +2 -2
- package/dist/core/use-intl.esm7.js +32 -10
- package/dist/core/use-intl.esm7.js.map +1 -1
- package/dist/core/use-intl.esm8.js +12 -47
- package/dist/core/use-intl.esm8.js.map +1 -1
- package/dist/core/use-intl.esm9.js +46 -28
- package/dist/core/use-intl.esm9.js.map +1 -1
- package/dist/core.cjs.development.js +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/{createIntl-8a2b87eb.js → createIntl-34d4281e.js} +28 -15
- package/dist/createIntl-34d4281e.js.map +1 -0
- package/dist/{createIntl-f7979de1.js → createIntl-bc325740.js} +2 -2
- package/dist/createIntl-bc325740.js.map +1 -0
- package/dist/react/IntlContext.d.ts +11 -2
- package/dist/react/IntlContext.esm.js.map +1 -1
- package/dist/react/IntlProvider.esm.js +9 -3
- package/dist/react/IntlProvider.esm.js.map +1 -1
- package/dist/react/use-intl.esm11.js.map +1 -1
- package/dist/react/use-intl.esm2.js +3 -19
- package/dist/react/use-intl.esm2.js.map +1 -1
- package/dist/react/use-intl.esm3.js +24 -39
- package/dist/react/use-intl.esm3.js.map +1 -1
- package/dist/react/use-intl.esm4.js +9 -3
- package/dist/react/use-intl.esm4.js.map +1 -1
- package/dist/react/use-intl.esm5.js +19 -3
- package/dist/react/use-intl.esm5.js.map +1 -1
- package/dist/react/use-intl.esm6.js +40 -3
- package/dist/react/use-intl.esm6.js.map +1 -1
- package/dist/react/use-intl.esm7.js +3 -25
- package/dist/react/use-intl.esm7.js.map +1 -1
- package/dist/react/use-intl.esm8.js +3 -3
- package/dist/react/use-intl.esm8.js.map +1 -1
- package/dist/react/use-intl.esm9.js +5 -5
- package/dist/react/use-intl.esm9.js.map +1 -1
- package/dist/react/useIntlContext.d.ts +10 -1
- package/dist/react/useTranslationsImpl.esm.js +4 -4
- package/dist/react/useTranslationsImpl.esm.js.map +1 -1
- package/dist/react.cjs.development.js +11 -5
- package/dist/react.cjs.development.js.map +1 -1
- package/dist/react.cjs.production.min.js +1 -1
- package/dist/react.cjs.production.min.js.map +1 -1
- package/dist/use-intl.cjs.development.js +37 -18
- 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 +10 -10
- package/package.json +1 -1
- package/dist/createIntl-8a2b87eb.js.map +0 -1
- package/dist/createIntl-f7979de1.js.map +0 -1
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
import { extends as _extends } from '../_virtual/use-intl.esm.js';
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/use-intl.esm.js';
|
|
2
|
+
import IntlError, { IntlErrorCode } from './use-intl.esm.js';
|
|
3
|
+
import createBaseTranslator from './use-intl.esm2.js';
|
|
4
|
+
import resolveNamespace from './use-intl.esm11.js';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
var _excluded = ["getMessageFallback", "messages", "namespace", "onError"];
|
|
7
|
+
function createTranslatorImpl(_ref, namespacePrefix) {
|
|
8
|
+
var getMessageFallback = _ref.getMessageFallback,
|
|
9
|
+
messages = _ref.messages,
|
|
10
|
+
namespace = _ref.namespace,
|
|
11
|
+
onError = _ref.onError,
|
|
12
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
13
|
+
// The `namespacePrefix` is part of the type system.
|
|
14
|
+
// See the comment in the function invocation.
|
|
15
|
+
messages = messages[namespacePrefix];
|
|
16
|
+
namespace = resolveNamespace(namespace, namespacePrefix);
|
|
17
|
+
var translator = createBaseTranslator(_extends({}, rest, {
|
|
18
|
+
onError: onError,
|
|
19
|
+
getMessageFallback: getMessageFallback,
|
|
20
|
+
messages: messages,
|
|
21
|
+
namespace: namespace
|
|
22
|
+
}));
|
|
23
|
+
var originalRich = translator.rich;
|
|
24
|
+
function base() {
|
|
25
|
+
return translator.apply(void 0, arguments);
|
|
26
|
+
}
|
|
27
|
+
// Augment `t.rich` to return plain strings
|
|
28
|
+
base.rich = function (key, /** Key value pairs for values to interpolate into the message. */
|
|
29
|
+
values, formats) {
|
|
30
|
+
// `chunks` is returned as a string when no React element
|
|
31
|
+
// is used, therefore it's safe to cast this type.
|
|
32
|
+
var result = originalRich(key, values, formats);
|
|
33
|
+
// When only string chunks are provided to the parser, only strings should be returned here.
|
|
34
|
+
if (typeof result !== 'string') {
|
|
35
|
+
var error = new IntlError(IntlErrorCode.FORMATTING_ERROR, process.env.NODE_ENV !== 'production' ? "`createTranslator` only accepts functions for rich text formatting that receive and return strings.\n\nE.g. t.rich('rich', {b: (chunks) => `<b>${chunks}</b>`})" : undefined);
|
|
36
|
+
onError(error);
|
|
37
|
+
return getMessageFallback({
|
|
38
|
+
error: error,
|
|
39
|
+
key: key,
|
|
40
|
+
namespace: namespace
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
base.raw = translator.raw;
|
|
46
|
+
return base;
|
|
29
47
|
}
|
|
30
48
|
|
|
31
|
-
export {
|
|
49
|
+
export { createTranslatorImpl as default };
|
|
32
50
|
//# sourceMappingURL=use-intl.esm9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm9.js","sources":["../../src/core/
|
|
1
|
+
{"version":3,"file":"use-intl.esm9.js","sources":["../../src/core/createTranslatorImpl.tsx"],"sourcesContent":["import AbstractIntlMessages from './AbstractIntlMessages';\nimport {InitializedIntlConfig} from './IntlConfig';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport {\n RichTranslationValues,\n RichTranslationValuesPlain\n} from './TranslationValues';\nimport createBaseTranslator from './createBaseTranslator';\nimport resolveNamespace from './resolveNamespace';\nimport NestedKeyOf from './utils/NestedKeyOf';\n\nexport type CreateTranslatorImplProps<Messages> = Omit<\n InitializedIntlConfig,\n 'messages'\n> & {\n namespace: string;\n messages: Messages;\n};\n\nexport default function createTranslatorImpl<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>(\n {\n getMessageFallback,\n messages,\n namespace,\n onError,\n ...rest\n }: CreateTranslatorImplProps<Messages>,\n namespacePrefix: string\n) {\n // The `namespacePrefix` is part of the type system.\n // See the comment in the function invocation.\n messages = messages[namespacePrefix] as Messages;\n namespace = resolveNamespace(namespace, namespacePrefix) as NestedKey;\n\n const translator = createBaseTranslator<Messages, NestedKey>({\n ...rest,\n onError,\n getMessageFallback,\n messages,\n namespace\n });\n\n const originalRich = translator.rich;\n\n function base(...args: Parameters<typeof translator>) {\n return translator(...args);\n }\n\n // Augment `t.rich` to return plain strings\n base.rich = (\n key: Parameters<typeof originalRich>[0],\n /** Key value pairs for values to interpolate into the message. */\n values: RichTranslationValuesPlain,\n formats?: Parameters<typeof originalRich>[2]\n ): string => {\n // `chunks` is returned as a string when no React element\n // is used, therefore it's safe to cast this type.\n const result = originalRich(key, values as RichTranslationValues, formats);\n\n // When only string chunks are provided to the parser, only strings should be returned here.\n if (typeof result !== 'string') {\n const error = new IntlError(\n IntlErrorCode.FORMATTING_ERROR,\n process.env.NODE_ENV !== 'production'\n ? \"`createTranslator` only accepts functions for rich text formatting that receive and return strings.\\n\\nE.g. t.rich('rich', {b: (chunks) => `<b>${chunks}</b>`})\"\n : undefined\n );\n\n onError(error);\n return getMessageFallback({error, key, namespace});\n }\n\n return result;\n };\n\n base.raw = translator.raw;\n\n return base;\n}\n"],"names":["createTranslatorImpl","_ref","namespacePrefix","getMessageFallback","messages","namespace","onError","rest","_objectWithoutPropertiesLoose","_excluded","resolveNamespace","translator","createBaseTranslator","_extends","originalRich","rich","base","apply","arguments","key","values","formats","result","error","IntlError","IntlErrorCode","FORMATTING_ERROR","process","env","NODE_ENV","undefined","raw"],"mappings":";;;;;;AAmBc,SAAUA,oBAAoBA,CAAAC,IAAA,EAW1CC,eAAuB,EAAA;AAAA,EAAA,IANrBC,kBAAkB,GAAAF,IAAA,CAAlBE,kBAAkB;IAClBC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,OAAO,GAAAL,IAAA,CAAPK,OAAO;AACJC,IAAAA,IAAI,GAAAC,6BAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;AAIT;AACA;AACAL,EAAAA,QAAQ,GAAGA,QAAQ,CAACF,eAAe,CAAa,CAAA;AAChDG,EAAAA,SAAS,GAAGK,gBAAgB,CAACL,SAAS,EAAEH,eAAe,CAAc,C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";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createIntl-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createIntl-bc325740.js");require("intl-messageformat"),require("react");var r=["getMessageFallback","messages","namespace","onError"],a=["getMessageFallback","messages","namespace","onError"];exports.IntlError=e.IntlError,Object.defineProperty(exports,"IntlErrorCode",{enumerable:!0,get:function(){return e.IntlErrorCode}}),exports.createBaseTranslator=e.createBaseTranslator,exports.createFormatter=e.createFormatter,exports.createIntl=e.createIntl,exports.initializeConfig=e.initializeConfig,exports.createTranslator=function(t){var s=t.getMessageFallback,o=void 0===s?e.defaultGetMessageFallback:s,n=t.messages,c=t.namespace,l=t.onError,i=void 0===l?e.defaultOnError:l,g=e._objectWithoutPropertiesLoose(t,a);return function(a,t){var s=a.getMessageFallback,o=a.messages,n=a.namespace,c=a.onError,l=e._objectWithoutPropertiesLoose(a,r);o=o["!"],n=e.resolveNamespace(n,"!");var i=e.createBaseTranslator(e._extends({},l,{onError:c,getMessageFallback:s,messages:o,namespace:n})),g=i.rich;function p(){return i.apply(void 0,arguments)}return p.rich=function(r,a,t){var o=g(r,a,t);if("string"!=typeof o){var l=new e.IntlError(e.IntlErrorCode.FORMATTING_ERROR,void 0);return c(l),s({error:l,key:r,namespace:n})}return o},p.raw=i.raw,p}(e._extends({},g,{onError:i,getMessageFallback:o,messages:{"!":n},namespace:c?"!."+c:"!"}))};
|
|
2
2
|
//# sourceMappingURL=core.cjs.production.min.js.map
|
|
@@ -158,9 +158,13 @@ function convertFormatsToIntlMessageFormat(formats, timeZone) {
|
|
|
158
158
|
var formatsWithTimeZone = timeZone ? _extends({}, formats, {
|
|
159
159
|
dateTime: setTimeZoneInFormats(formats.dateTime, timeZone)
|
|
160
160
|
}) : formats;
|
|
161
|
+
var mfDateDefaults = IntlMessageFormat__default["default"].formats.date;
|
|
162
|
+
var defaultDateFormats = timeZone ? setTimeZoneInFormats(mfDateDefaults, timeZone) : mfDateDefaults;
|
|
163
|
+
var mfTimeDefaults = IntlMessageFormat__default["default"].formats.time;
|
|
164
|
+
var defaultTimeFormats = timeZone ? setTimeZoneInFormats(mfTimeDefaults, timeZone) : mfTimeDefaults;
|
|
161
165
|
return _extends({}, formatsWithTimeZone, {
|
|
162
|
-
date: formatsWithTimeZone == null ? void 0 : formatsWithTimeZone.dateTime,
|
|
163
|
-
time: formatsWithTimeZone == null ? void 0 : formatsWithTimeZone.dateTime
|
|
166
|
+
date: _extends({}, defaultDateFormats, formatsWithTimeZone == null ? void 0 : formatsWithTimeZone.dateTime),
|
|
167
|
+
time: _extends({}, defaultTimeFormats, formatsWithTimeZone == null ? void 0 : formatsWithTimeZone.dateTime)
|
|
164
168
|
});
|
|
165
169
|
}
|
|
166
170
|
|
|
@@ -233,6 +237,18 @@ function getMessagesOrError(_ref) {
|
|
|
233
237
|
return intlError;
|
|
234
238
|
}
|
|
235
239
|
}
|
|
240
|
+
function getPlainMessage(candidate, values) {
|
|
241
|
+
if (values) return undefined;
|
|
242
|
+
var unescapedMessage = candidate.replace(/'([{}])/gi, '$1');
|
|
243
|
+
// Placeholders can be in the message if there are default values,
|
|
244
|
+
// or if the user has forgotten to provide values. In the latter
|
|
245
|
+
// case we need to compile the message to receive an error.
|
|
246
|
+
var hasPlaceholders = /<|{/.test(unescapedMessage);
|
|
247
|
+
if (!hasPlaceholders) {
|
|
248
|
+
return unescapedMessage;
|
|
249
|
+
}
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
236
252
|
function createBaseTranslator(config) {
|
|
237
253
|
var messagesOrError = getMessagesOrError({
|
|
238
254
|
messages: config.messages,
|
|
@@ -244,12 +260,12 @@ function createBaseTranslator(config) {
|
|
|
244
260
|
}));
|
|
245
261
|
}
|
|
246
262
|
function createBaseTranslatorImpl(_ref2) {
|
|
247
|
-
var
|
|
248
|
-
defaultTranslationValues = _ref2.defaultTranslationValues,
|
|
263
|
+
var defaultTranslationValues = _ref2.defaultTranslationValues,
|
|
249
264
|
globalFormats = _ref2.formats,
|
|
250
265
|
_ref2$getMessageFallb = _ref2.getMessageFallback,
|
|
251
266
|
getMessageFallback = _ref2$getMessageFallb === void 0 ? defaultGetMessageFallback : _ref2$getMessageFallb,
|
|
252
267
|
locale = _ref2.locale,
|
|
268
|
+
messageFormatCache = _ref2.messageFormatCache,
|
|
253
269
|
messagesOrError = _ref2.messagesOrError,
|
|
254
270
|
namespace = _ref2.namespace,
|
|
255
271
|
onError = _ref2.onError,
|
|
@@ -267,7 +283,6 @@ function createBaseTranslatorImpl(_ref2) {
|
|
|
267
283
|
key, /** Key value pairs for values to interpolate into the message. */
|
|
268
284
|
values, /** Provide custom formats for numbers, dates and times. */
|
|
269
285
|
formats) {
|
|
270
|
-
var _cachedFormatsByLocal;
|
|
271
286
|
if (messagesOrError instanceof IntlError) {
|
|
272
287
|
// We have already warned about this during render
|
|
273
288
|
return getMessageFallback({
|
|
@@ -288,10 +303,10 @@ function createBaseTranslatorImpl(_ref2) {
|
|
|
288
303
|
return part != null;
|
|
289
304
|
}).join('.');
|
|
290
305
|
}
|
|
291
|
-
var cacheKey = joinPath([namespace, key, String(message)]);
|
|
306
|
+
var cacheKey = joinPath([locale, namespace, key, String(message)]);
|
|
292
307
|
var messageFormat;
|
|
293
|
-
if (
|
|
294
|
-
messageFormat =
|
|
308
|
+
if (messageFormatCache != null && messageFormatCache.has(cacheKey)) {
|
|
309
|
+
messageFormat = messageFormatCache.get(cacheKey);
|
|
295
310
|
} else {
|
|
296
311
|
if (typeof message === 'object') {
|
|
297
312
|
var code, errorMessage;
|
|
@@ -308,17 +323,15 @@ function createBaseTranslatorImpl(_ref2) {
|
|
|
308
323
|
}
|
|
309
324
|
return getFallbackFromErrorAndNotify(key, code, errorMessage);
|
|
310
325
|
}
|
|
326
|
+
// Hot path that avoids creating an `IntlMessageFormat` instance
|
|
327
|
+
var plainMessage = getPlainMessage(message, values);
|
|
328
|
+
if (plainMessage) return plainMessage;
|
|
311
329
|
try {
|
|
312
330
|
messageFormat = new IntlMessageFormat__default["default"](message, locale, convertFormatsToIntlMessageFormat(_extends({}, globalFormats, formats), timeZone));
|
|
313
331
|
} catch (error) {
|
|
314
332
|
return getFallbackFromErrorAndNotify(key, exports.IntlErrorCode.INVALID_MESSAGE, error.message);
|
|
315
333
|
}
|
|
316
|
-
|
|
317
|
-
if (!cachedFormatsByLocale[locale]) {
|
|
318
|
-
cachedFormatsByLocale[locale] = {};
|
|
319
|
-
}
|
|
320
|
-
cachedFormatsByLocale[locale][cacheKey] = messageFormat;
|
|
321
|
-
}
|
|
334
|
+
messageFormatCache == null ? void 0 : messageFormatCache.set(cacheKey, messageFormat);
|
|
322
335
|
}
|
|
323
336
|
try {
|
|
324
337
|
var formattedMessage = messageFormat.format(
|
|
@@ -576,4 +589,4 @@ exports.defaultGetMessageFallback = defaultGetMessageFallback;
|
|
|
576
589
|
exports.defaultOnError = defaultOnError;
|
|
577
590
|
exports.initializeConfig = initializeConfig;
|
|
578
591
|
exports.resolveNamespace = resolveNamespace;
|
|
579
|
-
//# sourceMappingURL=createIntl-
|
|
592
|
+
//# sourceMappingURL=createIntl-34d4281e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createIntl-34d4281e.js","sources":["../src/core/IntlError.tsx","../src/core/convertFormatsToIntlMessageFormat.tsx","../src/core/defaults.tsx","../src/core/createBaseTranslator.tsx","../src/core/resolveNamespace.tsx","../src/core/createFormatter.tsx","../src/core/validateMessages.tsx","../src/core/initializeConfig.tsx","../src/core/createIntl.tsx"],"sourcesContent":["export enum IntlErrorCode {\n MISSING_MESSAGE = 'MISSING_MESSAGE',\n MISSING_FORMAT = 'MISSING_FORMAT',\n INSUFFICIENT_PATH = 'INSUFFICIENT_PATH',\n INVALID_MESSAGE = 'INVALID_MESSAGE',\n INVALID_KEY = 'INVALID_KEY',\n FORMATTING_ERROR = 'FORMATTING_ERROR'\n}\n\nexport default class IntlError extends Error {\n public readonly code: IntlErrorCode;\n public readonly originalMessage: string | undefined;\n\n constructor(code: IntlErrorCode, originalMessage?: string) {\n let message: string = code;\n if (originalMessage) {\n message += ': ' + originalMessage;\n }\n super(message);\n\n this.code = code;\n if (originalMessage) {\n this.originalMessage = originalMessage;\n }\n }\n}\n","// eslint-disable-next-line import/no-named-as-default -- False positive\nimport IntlMessageFormat, {Formats as IntlFormats} from 'intl-messageformat';\nimport DateTimeFormatOptions from './DateTimeFormatOptions';\nimport Formats from './Formats';\nimport TimeZone from './TimeZone';\n\nfunction setTimeZoneInFormats(\n formats: Record<string, DateTimeFormatOptions> | undefined,\n timeZone: TimeZone\n) {\n if (!formats) return formats;\n\n // The only way to set a time zone with `intl-messageformat` is to merge it into the formats\n // https://github.com/formatjs/formatjs/blob/8256c5271505cf2606e48e3c97ecdd16ede4f1b5/packages/intl/src/message.ts#L15\n return Object.keys(formats).reduce(\n (acc: Record<string, DateTimeFormatOptions>, key) => {\n acc[key] = {\n timeZone,\n ...formats[key]\n };\n return acc;\n },\n {}\n );\n}\n\n/**\n * `intl-messageformat` uses separate keys for `date` and `time`, but there's\n * only one native API: `Intl.DateTimeFormat`. Additionally you might want to\n * include both a time and a date in a value, therefore the separation doesn't\n * seem so useful. We offer a single `dateTime` namespace instead, but we have\n * to convert the format before `intl-messageformat` can be used.\n */\nexport default function convertFormatsToIntlMessageFormat(\n formats: Partial<Formats>,\n timeZone?: TimeZone\n): Partial<IntlFormats> {\n const formatsWithTimeZone = timeZone\n ? {...formats, dateTime: setTimeZoneInFormats(formats.dateTime, timeZone)}\n : formats;\n\n const mfDateDefaults = IntlMessageFormat.formats.date as Formats['dateTime'];\n const defaultDateFormats = timeZone\n ? setTimeZoneInFormats(mfDateDefaults, timeZone)\n : mfDateDefaults;\n\n const mfTimeDefaults = IntlMessageFormat.formats.time as Formats['dateTime'];\n const defaultTimeFormats = timeZone\n ? setTimeZoneInFormats(mfTimeDefaults, timeZone)\n : mfTimeDefaults;\n\n return {\n ...formatsWithTimeZone,\n date: {\n ...defaultDateFormats,\n ...formatsWithTimeZone?.dateTime\n },\n time: {\n ...defaultTimeFormats,\n ...formatsWithTimeZone?.dateTime\n }\n };\n}\n","import IntlError from './IntlError';\n\n/**\n * Contains defaults that are used for all entry points into the core.\n * See also `InitializedIntlConfiguration`.\n */\n\nexport function defaultGetMessageFallback(props: {\n error: IntlError;\n key: string;\n namespace?: string;\n}) {\n return [props.namespace, props.key].filter((part) => part != null).join('.');\n}\n\nexport function defaultOnError(error: IntlError) {\n console.error(error);\n}\n","// eslint-disable-next-line import/no-named-as-default -- False positive\nimport IntlMessageFormat from 'intl-messageformat';\nimport {\n cloneElement,\n isValidElement,\n ReactElement,\n ReactNode,\n ReactNodeArray\n} from 'react';\nimport AbstractIntlMessages from './AbstractIntlMessages';\nimport Formats from './Formats';\nimport {InitializedIntlConfig} from './IntlConfig';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport MessageFormatCache from './MessageFormatCache';\nimport TranslationValues, {RichTranslationValues} from './TranslationValues';\nimport convertFormatsToIntlMessageFormat from './convertFormatsToIntlMessageFormat';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport MessageKeys from './utils/MessageKeys';\nimport NestedKeyOf from './utils/NestedKeyOf';\nimport NestedValueOf from './utils/NestedValueOf';\n\nfunction resolvePath(\n messages: AbstractIntlMessages | undefined,\n key: string,\n namespace?: string\n) {\n if (!messages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages available at \\`${namespace}\\`.`\n : undefined\n );\n }\n\n let message = messages;\n\n key.split('.').forEach((part) => {\n const next = (message as any)[part];\n\n if (part == null || next == null) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `Could not resolve \\`${key}\\` in ${\n namespace ? `\\`${namespace}\\`` : 'messages'\n }.`\n : undefined\n );\n }\n\n message = next;\n });\n\n return message;\n}\n\nfunction prepareTranslationValues(values: RichTranslationValues) {\n if (Object.keys(values).length === 0) return undefined;\n\n // Workaround for https://github.com/formatjs/formatjs/issues/1467\n const transformedValues: RichTranslationValues = {};\n Object.keys(values).forEach((key) => {\n let index = 0;\n const value = values[key];\n\n let transformed;\n if (typeof value === 'function') {\n transformed = (chunks: ReactNode) => {\n const result = value(chunks);\n\n return isValidElement(result)\n ? cloneElement(result, {key: key + index++})\n : result;\n };\n } else {\n transformed = value;\n }\n\n transformedValues[key] = transformed;\n });\n\n return transformedValues;\n}\n\nfunction getMessagesOrError<Messages extends AbstractIntlMessages>({\n messages,\n namespace,\n onError = defaultOnError\n}: {\n messages?: Messages;\n namespace?: string;\n onError?(error: IntlError): void;\n}) {\n try {\n if (!messages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages were configured on the provider.`\n : undefined\n );\n }\n\n const retrievedMessages = namespace\n ? resolvePath(messages, namespace)\n : messages;\n\n if (!retrievedMessages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages for namespace \\`${namespace}\\` found.`\n : undefined\n );\n }\n\n return retrievedMessages;\n } catch (error) {\n const intlError = new IntlError(\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n onError(intlError);\n return intlError;\n }\n}\n\nexport type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {\n messageFormatCache?: MessageFormatCache;\n defaultTranslationValues?: RichTranslationValues;\n namespace?: string;\n messagesOrError: Messages | IntlError;\n};\n\nfunction getPlainMessage(candidate: string, values?: unknown) {\n if (values) return undefined;\n\n const unescapedMessage = candidate.replace(/'([{}])/gi, '$1');\n\n // Placeholders can be in the message if there are default values,\n // or if the user has forgotten to provide values. In the latter\n // case we need to compile the message to receive an error.\n const hasPlaceholders = /<|{/.test(unescapedMessage);\n\n if (!hasPlaceholders) {\n return unescapedMessage;\n }\n\n return undefined;\n}\n\nexport default function createBaseTranslator<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>(config: Omit<CreateBaseTranslatorProps<Messages>, 'messagesOrError'>) {\n const messagesOrError = getMessagesOrError({\n messages: config.messages,\n namespace: config.namespace,\n onError: config.onError\n }) as Messages | IntlError;\n\n return createBaseTranslatorImpl<Messages, NestedKey>({\n ...config,\n messagesOrError\n });\n}\n\nfunction createBaseTranslatorImpl<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>({\n defaultTranslationValues,\n formats: globalFormats,\n getMessageFallback = defaultGetMessageFallback,\n locale,\n messageFormatCache,\n messagesOrError,\n namespace,\n onError,\n timeZone\n}: CreateBaseTranslatorProps<Messages>) {\n function getFallbackFromErrorAndNotify(\n key: string,\n code: IntlErrorCode,\n message?: string\n ) {\n const error = new IntlError(code, message);\n onError(error);\n return getMessageFallback({error, key, namespace});\n }\n\n function translateBaseFn(\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: string,\n /** Key value pairs for values to interpolate into the message. */\n values?: RichTranslationValues,\n /** Provide custom formats for numbers, dates and times. */\n formats?: Partial<Formats>\n ): string | ReactElement | ReactNodeArray {\n if (messagesOrError instanceof IntlError) {\n // We have already warned about this during render\n return getMessageFallback({\n error: messagesOrError,\n key,\n namespace\n });\n }\n const messages = messagesOrError;\n\n let message;\n try {\n message = resolvePath(messages, key, namespace);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n }\n\n function joinPath(parts: Array<string | undefined>) {\n return parts.filter((part) => part != null).join('.');\n }\n\n const cacheKey = joinPath([locale, namespace, key, String(message)]);\n\n let messageFormat: IntlMessageFormat;\n if (messageFormatCache?.has(cacheKey)) {\n messageFormat = messageFormatCache.get(cacheKey)!;\n } else {\n if (typeof message === 'object') {\n let code, errorMessage;\n if (Array.isArray(message)) {\n code = IntlErrorCode.INVALID_MESSAGE;\n if (process.env.NODE_ENV !== 'production') {\n errorMessage = `Message at \\`${joinPath([\n namespace,\n key\n ])}\\` resolved to an array, but only strings are supported. See https://next-intl-docs.vercel.app/docs/usage/messages#arrays-of-messages`;\n }\n } else {\n code = IntlErrorCode.INSUFFICIENT_PATH;\n if (process.env.NODE_ENV !== 'production') {\n errorMessage = `Message at \\`${joinPath([\n namespace,\n key\n ])}\\` resolved to an object, but only strings are supported. Use a \\`.\\` to retrieve nested messages. See https://next-intl-docs.vercel.app/docs/usage/messages#structuring-messages`;\n }\n }\n\n return getFallbackFromErrorAndNotify(key, code, errorMessage);\n }\n\n // Hot path that avoids creating an `IntlMessageFormat` instance\n const plainMessage = getPlainMessage(message as string, values);\n if (plainMessage) return plainMessage;\n\n try {\n messageFormat = new IntlMessageFormat(\n message,\n locale,\n convertFormatsToIntlMessageFormat(\n {...globalFormats, ...formats},\n timeZone\n )\n );\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.INVALID_MESSAGE,\n (error as Error).message\n );\n }\n\n messageFormatCache?.set(cacheKey, messageFormat);\n }\n\n try {\n const formattedMessage = messageFormat.format(\n // @ts-ignore `intl-messageformat` expects a different format\n // for rich text elements since a recent minor update. This\n // needs to be evaluated in detail, possibly also in regards\n // to be able to format to parts.\n prepareTranslationValues({...defaultTranslationValues, ...values})\n );\n\n if (formattedMessage == null) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `Unable to format \\`${key}\\` in ${\n namespace ? `namespace \\`${namespace}\\`` : 'messages'\n }`\n : undefined\n );\n }\n\n // Limit the function signature to return strings or React elements\n return isValidElement(formattedMessage) ||\n // Arrays of React elements\n Array.isArray(formattedMessage) ||\n typeof formattedMessage === 'string'\n ? formattedMessage\n : String(formattedMessage);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.FORMATTING_ERROR,\n (error as Error).message\n );\n }\n }\n\n function translateFn<\n TargetKey extends MessageKeys<\n NestedValueOf<Messages, NestedKey>,\n NestedKeyOf<NestedValueOf<Messages, NestedKey>>\n >\n >(\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: TargetKey,\n /** Key value pairs for values to interpolate into the message. */\n values?: TranslationValues,\n /** Provide custom formats for numbers, dates and times. */\n formats?: Partial<Formats>\n ): string {\n const result = translateBaseFn(key, values, formats);\n\n if (typeof result !== 'string') {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.INVALID_MESSAGE,\n process.env.NODE_ENV !== 'production'\n ? `The message \\`${key}\\` in ${\n namespace ? `namespace \\`${namespace}\\`` : 'messages'\n } didn't resolve to a string. If you want to format rich text, use \\`t.rich\\` instead.`\n : undefined\n );\n }\n\n return result;\n }\n\n translateFn.rich = translateBaseFn;\n\n translateFn.raw = (\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: string\n ): any => {\n if (messagesOrError instanceof IntlError) {\n // We have already warned about this during render\n return getMessageFallback({\n error: messagesOrError,\n key,\n namespace\n });\n }\n const messages = messagesOrError;\n\n try {\n return resolvePath(messages, key, namespace);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n }\n };\n\n return translateFn;\n}\n","/**\n * For the strictly typed messages to work we have to wrap the namespace into\n * a mandatory prefix. See https://stackoverflow.com/a/71529575/343045\n */\nexport default function resolveNamespace(\n namespace: string,\n namespacePrefix: string\n) {\n return namespace === namespacePrefix\n ? undefined\n : namespace.slice((namespacePrefix + '.').length);\n}\n","import DateTimeFormatOptions from './DateTimeFormatOptions';\nimport Formats from './Formats';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport NumberFormatOptions from './NumberFormatOptions';\nimport TimeZone from './TimeZone';\nimport {defaultOnError} from './defaults';\n\nconst MINUTE = 60;\nconst HOUR = MINUTE * 60;\nconst DAY = HOUR * 24;\nconst WEEK = DAY * 7;\nconst MONTH = DAY * (365 / 12); // Approximation\nconst YEAR = DAY * 365;\n\nfunction getRelativeTimeFormatConfig(seconds: number) {\n const absValue = Math.abs(seconds);\n let value, unit: Intl.RelativeTimeFormatUnit;\n\n // We have to round the resulting values, as `Intl.RelativeTimeFormat`\n // will include fractions like '2.1 hours ago'.\n\n if (absValue < MINUTE) {\n unit = 'second';\n value = Math.round(seconds);\n } else if (absValue < HOUR) {\n unit = 'minute';\n value = Math.round(seconds / MINUTE);\n } else if (absValue < DAY) {\n unit = 'hour';\n value = Math.round(seconds / HOUR);\n } else if (absValue < WEEK) {\n unit = 'day';\n value = Math.round(seconds / DAY);\n } else if (absValue < MONTH) {\n unit = 'week';\n value = Math.round(seconds / WEEK);\n } else if (absValue < YEAR) {\n unit = 'month';\n value = Math.round(seconds / MONTH);\n } else {\n unit = 'year';\n value = Math.round(seconds / YEAR);\n }\n\n return {value, unit};\n}\n\ntype Props = {\n locale: string;\n timeZone?: TimeZone;\n onError?(error: IntlError): void;\n formats?: Partial<Formats>;\n now?: Date;\n};\n\nexport default function createFormatter({\n formats,\n locale,\n now: globalNow,\n onError = defaultOnError,\n timeZone\n}: Props) {\n function resolveFormatOrOptions<Options>(\n typeFormats: Record<string, Options> | undefined,\n formatOrOptions?: string | Options\n ) {\n let options;\n if (typeof formatOrOptions === 'string') {\n const formatName = formatOrOptions;\n options = typeFormats?.[formatName];\n\n if (!options) {\n const error = new IntlError(\n IntlErrorCode.MISSING_FORMAT,\n process.env.NODE_ENV !== 'production'\n ? `Format \\`${formatName}\\` is not available. You can configure it on the provider or provide custom options.`\n : undefined\n );\n onError(error);\n throw error;\n }\n } else {\n options = formatOrOptions;\n }\n\n return options;\n }\n\n function getFormattedValue<Value, Options>(\n value: Value,\n formatOrOptions: string | Options | undefined,\n typeFormats: Record<string, Options> | undefined,\n formatter: (options?: Options) => string\n ) {\n let options;\n try {\n options = resolveFormatOrOptions(typeFormats, formatOrOptions);\n } catch (error) {\n return String(value);\n }\n\n try {\n return formatter(options);\n } catch (error) {\n onError(\n new IntlError(IntlErrorCode.FORMATTING_ERROR, (error as Error).message)\n );\n return String(value);\n }\n }\n\n function dateTime(\n /** If a number is supplied, this is interpreted as a UTC timestamp. */\n value: Date | number,\n /** If a time zone is supplied, the `value` is converted to that time zone.\n * Otherwise the user time zone will be used. */\n formatOrOptions?: string | DateTimeFormatOptions\n ) {\n return getFormattedValue(\n value,\n formatOrOptions,\n formats?.dateTime,\n (options) => {\n if (timeZone && !options?.timeZone) {\n options = {...options, timeZone};\n }\n\n return new Intl.DateTimeFormat(locale, options).format(value);\n }\n );\n }\n\n function number(\n value: number | bigint,\n formatOrOptions?: string | NumberFormatOptions\n ) {\n return getFormattedValue(\n value,\n formatOrOptions,\n formats?.number,\n (options) => new Intl.NumberFormat(locale, options).format(value)\n );\n }\n\n function relativeTime(\n /** The date time that needs to be formatted. */\n date: number | Date,\n /** The reference point in time to which `date` will be formatted in relation to. */\n now?: number | Date\n ) {\n try {\n if (!now) {\n if (globalNow) {\n now = globalNow;\n } else {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `The \\`now\\` parameter wasn't provided and there was no global fallback configured on the provider.`\n : undefined\n );\n }\n }\n\n const dateDate = date instanceof Date ? date : new Date(date);\n const nowDate = now instanceof Date ? now : new Date(now);\n\n const seconds = (dateDate.getTime() - nowDate.getTime()) / 1000;\n const {unit, value} = getRelativeTimeFormatConfig(seconds);\n\n return new Intl.RelativeTimeFormat(locale, {\n numeric: 'auto'\n }).format(value, unit);\n } catch (error) {\n onError(\n new IntlError(IntlErrorCode.FORMATTING_ERROR, (error as Error).message)\n );\n return String(date);\n }\n }\n\n function list(\n value: Iterable<string>,\n formatOrOptions?: string | Intl.ListFormatOptions\n ) {\n return getFormattedValue(value, formatOrOptions, formats?.list, (options) =>\n new Intl.ListFormat(locale, options).format(value)\n );\n }\n\n return {dateTime, number, relativeTime, list};\n}\n","import AbstractIntlMessages from './AbstractIntlMessages';\nimport IntlError, {IntlErrorCode} from './IntlError';\n\nfunction validateMessagesSegment(\n messages: AbstractIntlMessages,\n invalidKeyLabels: Array<string>,\n parentPath?: string\n) {\n Object.entries(messages).forEach(([key, messageOrMessages]) => {\n if (key.includes('.')) {\n let keyLabel = key;\n if (parentPath) keyLabel += ` (at ${parentPath})`;\n invalidKeyLabels.push(keyLabel);\n }\n\n if (messageOrMessages != null && typeof messageOrMessages === 'object') {\n validateMessagesSegment(\n messageOrMessages,\n invalidKeyLabels,\n [parentPath, key].filter((part) => part != null).join('.')\n );\n }\n });\n}\n\nexport default function validateMessages(\n messages: AbstractIntlMessages,\n onError: (error: IntlError) => void\n) {\n const invalidKeyLabels: Array<string> = [];\n validateMessagesSegment(messages, invalidKeyLabels);\n\n if (invalidKeyLabels.length > 0) {\n onError(\n new IntlError(\n IntlErrorCode.INVALID_KEY,\n process.env.NODE_ENV !== 'production'\n ? `Namespace keys can not contain the character \".\" as this is used to express nesting. Please remove it or replace it with another character.\n\nInvalid ${\n invalidKeyLabels.length === 1 ? 'key' : 'keys'\n }: ${invalidKeyLabels.join(', ')}\n\nIf you're migrating from a flat structure, you can convert your messages as follows:\n\nimport {set} from \"lodash\";\n\nconst input = {\n \"one.one\": \"1.1\",\n \"one.two\": \"1.2\",\n \"two.one.one\": \"2.1.1\"\n};\n\nconst output = Object.entries(input).reduce(\n (acc, [key, value]) => set(acc, key, value),\n {}\n);\n\n// Output:\n//\n// {\n// \"one\": {\n// \"one\": \"1.1\",\n// \"two\": \"1.2\"\n// },\n// \"two\": {\n// \"one\": {\n// \"one\": \"2.1.1\"\n// }\n// }\n// }\n`\n : undefined\n )\n );\n }\n}\n","import IntlConfig from './IntlConfig';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport validateMessages from './validateMessages';\n\n/**\n * Enhances the incoming props with defaults.\n */\nexport default function initializeConfig<\n // This is a generic to allow for stricter typing. E.g.\n // the RSC integration always provides a `now` value.\n Props extends Omit<IntlConfig, 'children'>\n>({getMessageFallback, messages, onError, ...rest}: Props) {\n const finalOnError = onError || defaultOnError;\n const finalGetMessageFallback =\n getMessageFallback || defaultGetMessageFallback;\n\n if (process.env.NODE_ENV !== 'production') {\n if (messages) {\n validateMessages(messages, finalOnError);\n }\n }\n\n return {\n ...rest,\n messages,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback\n };\n}\n","import createFormatter from './createFormatter';\n\n/** @deprecated Switch to `createFormatter` */\nexport default function createIntl(\n ...args: Parameters<typeof createFormatter>\n) {\n const formatter = createFormatter(...args);\n return {\n formatDateTime: formatter.dateTime,\n formatNumber: formatter.number,\n formatRelativeTime: formatter.relativeTime\n };\n}\n"],"names":["IntlErrorCode","IntlError","_Error","_inheritsLoose","code","originalMessage","_this","message","call","_wrapNativeSuper","Error","setTimeZoneInFormats","formats","timeZone","Object","keys","reduce","acc","key","_extends","convertFormatsToIntlMessageFormat","formatsWithTimeZone","dateTime","mfDateDefaults","IntlMessageFormat","date","defaultDateFormats","mfTimeDefaults","time","defaultTimeFormats","defaultGetMessageFallback","props","namespace","filter","part","join","defaultOnError","error","console","resolvePath","messages","split","forEach","next","prepareTranslationValues","values","length","undefined","transformedValues","index","value","transformed","chunks","result","isValidElement","cloneElement","getMessagesOrError","_ref","_ref$onError","onError","process","retrievedMessages","intlError","MISSING_MESSAGE","getPlainMessage","candidate","unescapedMessage","replace","hasPlaceholders","test","createBaseTranslator","config","messagesOrError","createBaseTranslatorImpl","_ref2","defaultTranslationValues","globalFormats","_ref2$getMessageFallb","getMessageFallback","locale","messageFormatCache","getFallbackFromErrorAndNotify","translateBaseFn","joinPath","parts","cacheKey","String","messageFormat","has","get","errorMessage","Array","isArray","INVALID_MESSAGE","INSUFFICIENT_PATH","plainMessage","set","formattedMessage","format","FORMATTING_ERROR","translateFn","rich","raw","resolveNamespace","namespacePrefix","slice","MINUTE","HOUR","DAY","WEEK","MONTH","YEAR","getRelativeTimeFormatConfig","seconds","absValue","Math","abs","unit","round","createFormatter","globalNow","now","resolveFormatOrOptions","typeFormats","formatOrOptions","options","formatName","MISSING_FORMAT","getFormattedValue","formatter","_options","Intl","DateTimeFormat","number","NumberFormat","relativeTime","dateDate","Date","nowDate","getTime","_getRelativeTimeForma","RelativeTimeFormat","numeric","list","ListFormat","validateMessagesSegment","invalidKeyLabels","parentPath","entries","messageOrMessages","includes","keyLabel","push","validateMessages","INVALID_KEY","initializeConfig","rest","_objectWithoutPropertiesLoose","_excluded","finalOnError","finalGetMessageFallback","createIntl","apply","arguments","formatDateTime","formatNumber","formatRelativeTime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAYA,+BAOX;AAPD,CAAA,UAAYA,aAAa,EAAA;AACvBA,EAAAA,aAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,aAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC,CAAA;AACjCA,EAAAA,aAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AACvCA,EAAAA,aAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,aAAA,CAAA,aAAA,CAAA,GAAA,aAA2B,CAAA;AAC3BA,EAAAA,aAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC,CAAA;AACvC,CAAC,EAPWA,qBAAa,KAAbA,qBAAa,GAOxB,EAAA,CAAA,CAAA,CAAA;AAEoBC,IAAAA,SAAU,0BAAAC,MAAA,EAAA;EAAAC,cAAA,CAAAF,SAAA,EAAAC,MAAA,CAAA,CAAA;AAI7B,EAAA,SAAAD,SAAYG,CAAAA,IAAmB,EAAEC,eAAwB,EAAA;AAAA,IAAA,IAAAC,KAAA,CAAA;IACvD,IAAIC,OAAO,GAAWH,IAAI,CAAA;AAC1B,IAAA,IAAIC,eAAe,EAAE;MACnBE,OAAO,IAAI,IAAI,GAAGF,eAAe,CAAA;AAClC,KAAA;AACDC,IAAAA,KAAA,GAAAJ,MAAA,CAAAM,IAAA,CAAA,IAAA,EAAMD,OAAO,CAAC,IAAA,IAAA,CAAA;AAACD,IAAAA,KAAA,CARDF,IAAI,GAAA,KAAA,CAAA,CAAA;AAAAE,IAAAA,KAAA,CACJD,eAA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AlG,IAAA,EAIiB;AAAA,EAAA,IAAtDqB,kBAAkB,GAAArB,IAAA,CAAlBqB,kBAAkB;IAAEtC,QAAQ,GAAAiB,IAAA,CAARjB,QAAQ;IAAEmB,OAAO,GAAAF,IAAA,CAAPE,OAAO;AAAKiG,IAAAA,IAAI,GAAAC,6BAAA,CAAApG,IAAA,EAAAqG,SAAA,CAAA,CAAA;AAC/C,EAAA,IAAMC,YAAY,GAAGpG,OAAO,IAAIvB,cAAc,CAAA;AAC9C,EAAA,IAAM4H,uBAAuB,GAC3BlF,kBAAkB,IAAIhD,yBAAyB,CAAA;AAEjD,EAA2C;AACzC,IAAA,IAAIU,QAAQ,EAAE;AACZiH,MAAAA,gBAAgB,CAACjH,QAAQ,EAAEuH,YAAY,CAAC,CAAA;AACzC,KAAA;AACF,GAAA;EAED,OAAA5I,QAAA,KACKyI,IAAI,EAAA;AACPpH,IAAAA,QAAQ,EAARA,QAAQ;AACRmB,IAAAA,OAAO,EAAEoG,YAAY;AACrBjF,IAAAA,kBAAkB,EAAEkF,uBAAAA;AAAuB,GAAA,CAAA,CAAA;AAE/C;;AC1BA;AACc,SAAUC,UAAUA,GACW;AAE3C,EAAA,IAAMhC,SAAS,GAAGV,eAAe,CAAA2C,KAAA,CAAA,KAAA,CAAA,EAAAC,SAAQ,CAAC,CAAA;EAC1C,OAAO;IACLC,cAAc,EAAEnC,SAAS,CAAC3G,QAAQ;IAClC+I,YAAY,EAAEpC,SAAS,CAACI,MAAM;IAC9BiC,kBAAkB,EAAErC,SAAS,CAACM,YAAAA;GAC/B,CAAA;AACH;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("intl-messageformat"),e=require("react");function t(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var n,o=t(r);function a(){return a=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},a.apply(this,arguments)}function i(r){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},i(r)}function u(r,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},u(r,e)}function c(r,e,t){return c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(r){return!1}}()?Reflect.construct.bind():function(r,e,t){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(r,n));return t&&u(o,t.prototype),o},c.apply(null,arguments)}function s(r){var e="function"==typeof Map?new Map:void 0;return s=function(r){if(null===r||-1===Function.toString.call(r).indexOf("[native code]"))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return c(r,arguments,i(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),u(t,r)},s(r)}function l(r,e){if(null==r)return{};var t,n,o={},a=Object.keys(r);for(n=0;n<a.length;n++)e.indexOf(t=a[n])>=0||(o[t]=r[t]);return o}exports.IntlErrorCode=void 0,(n=exports.IntlErrorCode||(exports.IntlErrorCode={})).MISSING_MESSAGE="MISSING_MESSAGE",n.MISSING_FORMAT="MISSING_FORMAT",n.INSUFFICIENT_PATH="INSUFFICIENT_PATH",n.INVALID_MESSAGE="INVALID_MESSAGE",n.INVALID_KEY="INVALID_KEY",n.FORMATTING_ERROR="FORMATTING_ERROR";var f=function(r){var e,t;function n(e,t){var n,o=e;return t&&(o+=": "+t),(n=r.call(this,o)||this).code=void 0,n.originalMessage=void 0,n.code=e,t&&(n.originalMessage=t),n}return t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t),n}(s(Error));function p(r,e){return r?Object.keys(r).reduce((function(t,n){return t[n]=a({timeZone:e},r[n]),t}),{}):r}function d(r){return[r.namespace,r.key].filter((function(r){return null!=r})).join(".")}function m(r){console.error(r)}function v(r,e,t){if(!r)throw new Error(void 0);var n=r;return e.split(".").forEach((function(r){var e=n[r];if(null==r||null==e)throw new Error(void 0);n=e})),n}var E=86400,I=7*E,y=2628e3,g=365*E;function
|
|
2
|
-
//# sourceMappingURL=createIntl-
|
|
1
|
+
"use strict";var r=require("intl-messageformat"),e=require("react");function t(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var n,o=t(r);function a(){return a=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},a.apply(this,arguments)}function i(r){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},i(r)}function u(r,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},u(r,e)}function c(r,e,t){return c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(r){return!1}}()?Reflect.construct.bind():function(r,e,t){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(r,n));return t&&u(o,t.prototype),o},c.apply(null,arguments)}function s(r){var e="function"==typeof Map?new Map:void 0;return s=function(r){if(null===r||-1===Function.toString.call(r).indexOf("[native code]"))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return c(r,arguments,i(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),u(t,r)},s(r)}function l(r,e){if(null==r)return{};var t,n,o={},a=Object.keys(r);for(n=0;n<a.length;n++)e.indexOf(t=a[n])>=0||(o[t]=r[t]);return o}exports.IntlErrorCode=void 0,(n=exports.IntlErrorCode||(exports.IntlErrorCode={})).MISSING_MESSAGE="MISSING_MESSAGE",n.MISSING_FORMAT="MISSING_FORMAT",n.INSUFFICIENT_PATH="INSUFFICIENT_PATH",n.INVALID_MESSAGE="INVALID_MESSAGE",n.INVALID_KEY="INVALID_KEY",n.FORMATTING_ERROR="FORMATTING_ERROR";var f=function(r){var e,t;function n(e,t){var n,o=e;return t&&(o+=": "+t),(n=r.call(this,o)||this).code=void 0,n.originalMessage=void 0,n.code=e,t&&(n.originalMessage=t),n}return t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t),n}(s(Error));function p(r,e){return r?Object.keys(r).reduce((function(t,n){return t[n]=a({timeZone:e},r[n]),t}),{}):r}function d(r){return[r.namespace,r.key].filter((function(r){return null!=r})).join(".")}function m(r){console.error(r)}function v(r,e,t){if(!r)throw new Error(void 0);var n=r;return e.split(".").forEach((function(r){var e=n[r];if(null==r||null==e)throw new Error(void 0);n=e})),n}var E=86400,I=7*E,y=2628e3,g=365*E;function h(r){var e=r.formats,t=r.locale,n=r.now,o=r.onError,i=void 0===o?m:o,u=r.timeZone;function c(r,e,t,n){var o;try{o=function(r,e){var t;if("string"==typeof e){if(!(t=null==r?void 0:r[e])){var n=new f(exports.IntlErrorCode.MISSING_FORMAT,void 0);throw i(n),n}}else t=e;return t}(t,e)}catch(e){return String(r)}try{return n(o)}catch(e){return i(new f(exports.IntlErrorCode.FORMATTING_ERROR,e.message)),String(r)}}return{dateTime:function(r,n){return c(r,n,null==e?void 0:e.dateTime,(function(e){var n;return!u||null!=(n=e)&&n.timeZone||(e=a({},e,{timeZone:u})),new Intl.DateTimeFormat(t,e).format(r)}))},number:function(r,n){return c(r,n,null==e?void 0:e.number,(function(e){return new Intl.NumberFormat(t,e).format(r)}))},relativeTime:function(r,e){try{if(!e){if(!n)throw new Error(void 0);e=n}var o=r instanceof Date?r:new Date(r),a=e instanceof Date?e:new Date(e),u=function(r){var e,t,n=Math.abs(r);return n<60?(t="second",e=Math.round(r)):n<3600?(t="minute",e=Math.round(r/60)):n<E?(t="hour",e=Math.round(r/3600)):n<I?(t="day",e=Math.round(r/E)):n<y?(t="week",e=Math.round(r/I)):n<g?(t="month",e=Math.round(r/y)):(t="year",e=Math.round(r/g)),{value:e,unit:t}}((o.getTime()-a.getTime())/1e3),c=u.unit,s=u.value;return new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(s,c)}catch(e){return i(new f(exports.IntlErrorCode.FORMATTING_ERROR,e.message)),String(r)}},list:function(r,n){return c(r,n,null==e?void 0:e.list,(function(e){return new Intl.ListFormat(t,e).format(r)}))}}}var S=["getMessageFallback","messages","onError"];exports.IntlError=f,exports._extends=a,exports._objectWithoutPropertiesLoose=l,exports.createBaseTranslator=function(r){return function(r){var t=r.defaultTranslationValues,n=r.formats,i=r.getMessageFallback,u=void 0===i?d:i,c=r.locale,s=r.messageFormatCache,l=r.messagesOrError,m=r.namespace,E=r.onError,I=r.timeZone;function y(r,e,t){var n=new f(e,t);return E(n),u({error:n,key:r,namespace:m})}function g(r,i,d){if(l instanceof f)return u({error:l,key:r,namespace:m});var E,g=l;try{E=v(g,r)}catch(e){return y(r,exports.IntlErrorCode.MISSING_MESSAGE,e.message)}var h,S=[c,m,r,String(E)].filter((function(r){return null!=r})).join(".");if(null!=s&&s.has(S))h=s.get(S);else{if("object"==typeof E)return y(r,Array.isArray(E)?exports.IntlErrorCode.INVALID_MESSAGE:exports.IntlErrorCode.INSUFFICIENT_PATH,void 0);var M=function(r,e){if(!e){var t=r.replace(/'([{}])/gi,"$1");return/<|{/.test(t)?void 0:t}}(E,i);if(M)return M;try{h=new o.default(E,c,function(r,e){var t=e?a({},r,{dateTime:p(r.dateTime,e)}):r,n=o.default.formats.date,i=e?p(n,e):n,u=o.default.formats.time,c=e?p(u,e):u;return a({},t,{date:a({},i,null==t?void 0:t.dateTime),time:a({},c,null==t?void 0:t.dateTime)})}(a({},n,d),I))}catch(e){return y(r,exports.IntlErrorCode.INVALID_MESSAGE,e.message)}null==s||s.set(S,h)}try{var O=h.format(function(r){if(0!==Object.keys(r).length){var t={};return Object.keys(r).forEach((function(n){var o=0,a=r[n];t[n]="function"==typeof a?function(r){var t=a(r);return e.isValidElement(t)?e.cloneElement(t,{key:n+o++}):t}:a})),t}}(a({},t,i)));if(null==O)throw new Error(void 0);return e.isValidElement(O)||Array.isArray(O)||"string"==typeof O?O:String(O)}catch(e){return y(r,exports.IntlErrorCode.FORMATTING_ERROR,e.message)}}function h(r,e,t){var n=g(r,e,t);return"string"!=typeof n?y(r,exports.IntlErrorCode.INVALID_MESSAGE,void 0):n}return h.rich=g,h.raw=function(r){if(l instanceof f)return u({error:l,key:r,namespace:m});var e=l;try{return v(e,r)}catch(e){return y(r,exports.IntlErrorCode.MISSING_MESSAGE,e.message)}},h}(a({},r,{messagesOrError:function(r){var e=r.messages,t=r.namespace,n=r.onError,o=void 0===n?m:n;try{if(!e)throw new Error(void 0);var a=t?v(e,t):e;if(!a)throw new Error(void 0);return a}catch(r){var i=new f(exports.IntlErrorCode.MISSING_MESSAGE,r.message);return o(i),i}}({messages:r.messages,namespace:r.namespace,onError:r.onError})}))},exports.createFormatter=h,exports.createIntl=function(){var r=h.apply(void 0,arguments);return{formatDateTime:r.dateTime,formatNumber:r.number,formatRelativeTime:r.relativeTime}},exports.defaultGetMessageFallback=d,exports.defaultOnError=m,exports.initializeConfig=function(r){var e=r.getMessageFallback,t=r.messages,n=r.onError;return a({},l(r,S),{messages:t,onError:n||m,getMessageFallback:e||d})},exports.resolveNamespace=function(r,e){return r===e?void 0:r.slice((e+".").length)};
|
|
2
|
+
//# sourceMappingURL=createIntl-bc325740.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createIntl-bc325740.js","sources":["../src/core/IntlError.tsx","../src/core/convertFormatsToIntlMessageFormat.tsx","../src/core/defaults.tsx","../src/core/createBaseTranslator.tsx","../src/core/createFormatter.tsx","../src/core/createIntl.tsx","../src/core/initializeConfig.tsx","../src/core/resolveNamespace.tsx"],"sourcesContent":["export enum IntlErrorCode {\n MISSING_MESSAGE = 'MISSING_MESSAGE',\n MISSING_FORMAT = 'MISSING_FORMAT',\n INSUFFICIENT_PATH = 'INSUFFICIENT_PATH',\n INVALID_MESSAGE = 'INVALID_MESSAGE',\n INVALID_KEY = 'INVALID_KEY',\n FORMATTING_ERROR = 'FORMATTING_ERROR'\n}\n\nexport default class IntlError extends Error {\n public readonly code: IntlErrorCode;\n public readonly originalMessage: string | undefined;\n\n constructor(code: IntlErrorCode, originalMessage?: string) {\n let message: string = code;\n if (originalMessage) {\n message += ': ' + originalMessage;\n }\n super(message);\n\n this.code = code;\n if (originalMessage) {\n this.originalMessage = originalMessage;\n }\n }\n}\n","// eslint-disable-next-line import/no-named-as-default -- False positive\nimport IntlMessageFormat, {Formats as IntlFormats} from 'intl-messageformat';\nimport DateTimeFormatOptions from './DateTimeFormatOptions';\nimport Formats from './Formats';\nimport TimeZone from './TimeZone';\n\nfunction setTimeZoneInFormats(\n formats: Record<string, DateTimeFormatOptions> | undefined,\n timeZone: TimeZone\n) {\n if (!formats) return formats;\n\n // The only way to set a time zone with `intl-messageformat` is to merge it into the formats\n // https://github.com/formatjs/formatjs/blob/8256c5271505cf2606e48e3c97ecdd16ede4f1b5/packages/intl/src/message.ts#L15\n return Object.keys(formats).reduce(\n (acc: Record<string, DateTimeFormatOptions>, key) => {\n acc[key] = {\n timeZone,\n ...formats[key]\n };\n return acc;\n },\n {}\n );\n}\n\n/**\n * `intl-messageformat` uses separate keys for `date` and `time`, but there's\n * only one native API: `Intl.DateTimeFormat`. Additionally you might want to\n * include both a time and a date in a value, therefore the separation doesn't\n * seem so useful. We offer a single `dateTime` namespace instead, but we have\n * to convert the format before `intl-messageformat` can be used.\n */\nexport default function convertFormatsToIntlMessageFormat(\n formats: Partial<Formats>,\n timeZone?: TimeZone\n): Partial<IntlFormats> {\n const formatsWithTimeZone = timeZone\n ? {...formats, dateTime: setTimeZoneInFormats(formats.dateTime, timeZone)}\n : formats;\n\n const mfDateDefaults = IntlMessageFormat.formats.date as Formats['dateTime'];\n const defaultDateFormats = timeZone\n ? setTimeZoneInFormats(mfDateDefaults, timeZone)\n : mfDateDefaults;\n\n const mfTimeDefaults = IntlMessageFormat.formats.time as Formats['dateTime'];\n const defaultTimeFormats = timeZone\n ? setTimeZoneInFormats(mfTimeDefaults, timeZone)\n : mfTimeDefaults;\n\n return {\n ...formatsWithTimeZone,\n date: {\n ...defaultDateFormats,\n ...formatsWithTimeZone?.dateTime\n },\n time: {\n ...defaultTimeFormats,\n ...formatsWithTimeZone?.dateTime\n }\n };\n}\n","import IntlError from './IntlError';\n\n/**\n * Contains defaults that are used for all entry points into the core.\n * See also `InitializedIntlConfiguration`.\n */\n\nexport function defaultGetMessageFallback(props: {\n error: IntlError;\n key: string;\n namespace?: string;\n}) {\n return [props.namespace, props.key].filter((part) => part != null).join('.');\n}\n\nexport function defaultOnError(error: IntlError) {\n console.error(error);\n}\n","// eslint-disable-next-line import/no-named-as-default -- False positive\nimport IntlMessageFormat from 'intl-messageformat';\nimport {\n cloneElement,\n isValidElement,\n ReactElement,\n ReactNode,\n ReactNodeArray\n} from 'react';\nimport AbstractIntlMessages from './AbstractIntlMessages';\nimport Formats from './Formats';\nimport {InitializedIntlConfig} from './IntlConfig';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport MessageFormatCache from './MessageFormatCache';\nimport TranslationValues, {RichTranslationValues} from './TranslationValues';\nimport convertFormatsToIntlMessageFormat from './convertFormatsToIntlMessageFormat';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport MessageKeys from './utils/MessageKeys';\nimport NestedKeyOf from './utils/NestedKeyOf';\nimport NestedValueOf from './utils/NestedValueOf';\n\nfunction resolvePath(\n messages: AbstractIntlMessages | undefined,\n key: string,\n namespace?: string\n) {\n if (!messages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages available at \\`${namespace}\\`.`\n : undefined\n );\n }\n\n let message = messages;\n\n key.split('.').forEach((part) => {\n const next = (message as any)[part];\n\n if (part == null || next == null) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `Could not resolve \\`${key}\\` in ${\n namespace ? `\\`${namespace}\\`` : 'messages'\n }.`\n : undefined\n );\n }\n\n message = next;\n });\n\n return message;\n}\n\nfunction prepareTranslationValues(values: RichTranslationValues) {\n if (Object.keys(values).length === 0) return undefined;\n\n // Workaround for https://github.com/formatjs/formatjs/issues/1467\n const transformedValues: RichTranslationValues = {};\n Object.keys(values).forEach((key) => {\n let index = 0;\n const value = values[key];\n\n let transformed;\n if (typeof value === 'function') {\n transformed = (chunks: ReactNode) => {\n const result = value(chunks);\n\n return isValidElement(result)\n ? cloneElement(result, {key: key + index++})\n : result;\n };\n } else {\n transformed = value;\n }\n\n transformedValues[key] = transformed;\n });\n\n return transformedValues;\n}\n\nfunction getMessagesOrError<Messages extends AbstractIntlMessages>({\n messages,\n namespace,\n onError = defaultOnError\n}: {\n messages?: Messages;\n namespace?: string;\n onError?(error: IntlError): void;\n}) {\n try {\n if (!messages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages were configured on the provider.`\n : undefined\n );\n }\n\n const retrievedMessages = namespace\n ? resolvePath(messages, namespace)\n : messages;\n\n if (!retrievedMessages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages for namespace \\`${namespace}\\` found.`\n : undefined\n );\n }\n\n return retrievedMessages;\n } catch (error) {\n const intlError = new IntlError(\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n onError(intlError);\n return intlError;\n }\n}\n\nexport type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {\n messageFormatCache?: MessageFormatCache;\n defaultTranslationValues?: RichTranslationValues;\n namespace?: string;\n messagesOrError: Messages | IntlError;\n};\n\nfunction getPlainMessage(candidate: string, values?: unknown) {\n if (values) return undefined;\n\n const unescapedMessage = candidate.replace(/'([{}])/gi, '$1');\n\n // Placeholders can be in the message if there are default values,\n // or if the user has forgotten to provide values. In the latter\n // case we need to compile the message to receive an error.\n const hasPlaceholders = /<|{/.test(unescapedMessage);\n\n if (!hasPlaceholders) {\n return unescapedMessage;\n }\n\n return undefined;\n}\n\nexport default function createBaseTranslator<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>(config: Omit<CreateBaseTranslatorProps<Messages>, 'messagesOrError'>) {\n const messagesOrError = getMessagesOrError({\n messages: config.messages,\n namespace: config.namespace,\n onError: config.onError\n }) as Messages | IntlError;\n\n return createBaseTranslatorImpl<Messages, NestedKey>({\n ...config,\n messagesOrError\n });\n}\n\nfunction createBaseTranslatorImpl<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>({\n defaultTranslationValues,\n formats: globalFormats,\n getMessageFallback = defaultGetMessageFallback,\n locale,\n messageFormatCache,\n messagesOrError,\n namespace,\n onError,\n timeZone\n}: CreateBaseTranslatorProps<Messages>) {\n function getFallbackFromErrorAndNotify(\n key: string,\n code: IntlErrorCode,\n message?: string\n ) {\n const error = new IntlError(code, message);\n onError(error);\n return getMessageFallback({error, key, namespace});\n }\n\n function translateBaseFn(\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: string,\n /** Key value pairs for values to interpolate into the message. */\n values?: RichTranslationValues,\n /** Provide custom formats for numbers, dates and times. */\n formats?: Partial<Formats>\n ): string | ReactElement | ReactNodeArray {\n if (messagesOrError instanceof IntlError) {\n // We have already warned about this during render\n return getMessageFallback({\n error: messagesOrError,\n key,\n namespace\n });\n }\n const messages = messagesOrError;\n\n let message;\n try {\n message = resolvePath(messages, key, namespace);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n }\n\n function joinPath(parts: Array<string | undefined>) {\n return parts.filter((part) => part != null).join('.');\n }\n\n const cacheKey = joinPath([locale, namespace, key, String(message)]);\n\n let messageFormat: IntlMessageFormat;\n if (messageFormatCache?.has(cacheKey)) {\n messageFormat = messageFormatCache.get(cacheKey)!;\n } else {\n if (typeof message === 'object') {\n let code, errorMessage;\n if (Array.isArray(message)) {\n code = IntlErrorCode.INVALID_MESSAGE;\n if (process.env.NODE_ENV !== 'production') {\n errorMessage = `Message at \\`${joinPath([\n namespace,\n key\n ])}\\` resolved to an array, but only strings are supported. See https://next-intl-docs.vercel.app/docs/usage/messages#arrays-of-messages`;\n }\n } else {\n code = IntlErrorCode.INSUFFICIENT_PATH;\n if (process.env.NODE_ENV !== 'production') {\n errorMessage = `Message at \\`${joinPath([\n namespace,\n key\n ])}\\` resolved to an object, but only strings are supported. Use a \\`.\\` to retrieve nested messages. See https://next-intl-docs.vercel.app/docs/usage/messages#structuring-messages`;\n }\n }\n\n return getFallbackFromErrorAndNotify(key, code, errorMessage);\n }\n\n // Hot path that avoids creating an `IntlMessageFormat` instance\n const plainMessage = getPlainMessage(message as string, values);\n if (plainMessage) return plainMessage;\n\n try {\n messageFormat = new IntlMessageFormat(\n message,\n locale,\n convertFormatsToIntlMessageFormat(\n {...globalFormats, ...formats},\n timeZone\n )\n );\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.INVALID_MESSAGE,\n (error as Error).message\n );\n }\n\n messageFormatCache?.set(cacheKey, messageFormat);\n }\n\n try {\n const formattedMessage = messageFormat.format(\n // @ts-ignore `intl-messageformat` expects a different format\n // for rich text elements since a recent minor update. This\n // needs to be evaluated in detail, possibly also in regards\n // to be able to format to parts.\n prepareTranslationValues({...defaultTranslationValues, ...values})\n );\n\n if (formattedMessage == null) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `Unable to format \\`${key}\\` in ${\n namespace ? `namespace \\`${namespace}\\`` : 'messages'\n }`\n : undefined\n );\n }\n\n // Limit the function signature to return strings or React elements\n return isValidElement(formattedMessage) ||\n // Arrays of React elements\n Array.isArray(formattedMessage) ||\n typeof formattedMessage === 'string'\n ? formattedMessage\n : String(formattedMessage);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.FORMATTING_ERROR,\n (error as Error).message\n );\n }\n }\n\n function translateFn<\n TargetKey extends MessageKeys<\n NestedValueOf<Messages, NestedKey>,\n NestedKeyOf<NestedValueOf<Messages, NestedKey>>\n >\n >(\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: TargetKey,\n /** Key value pairs for values to interpolate into the message. */\n values?: TranslationValues,\n /** Provide custom formats for numbers, dates and times. */\n formats?: Partial<Formats>\n ): string {\n const result = translateBaseFn(key, values, formats);\n\n if (typeof result !== 'string') {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.INVALID_MESSAGE,\n process.env.NODE_ENV !== 'production'\n ? `The message \\`${key}\\` in ${\n namespace ? `namespace \\`${namespace}\\`` : 'messages'\n } didn't resolve to a string. If you want to format rich text, use \\`t.rich\\` instead.`\n : undefined\n );\n }\n\n return result;\n }\n\n translateFn.rich = translateBaseFn;\n\n translateFn.raw = (\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: string\n ): any => {\n if (messagesOrError instanceof IntlError) {\n // We have already warned about this during render\n return getMessageFallback({\n error: messagesOrError,\n key,\n namespace\n });\n }\n const messages = messagesOrError;\n\n try {\n return resolvePath(messages, key, namespace);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n }\n };\n\n return translateFn;\n}\n","import DateTimeFormatOptions from './DateTimeFormatOptions';\nimport Formats from './Formats';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport NumberFormatOptions from './NumberFormatOptions';\nimport TimeZone from './TimeZone';\nimport {defaultOnError} from './defaults';\n\nconst MINUTE = 60;\nconst HOUR = MINUTE * 60;\nconst DAY = HOUR * 24;\nconst WEEK = DAY * 7;\nconst MONTH = DAY * (365 / 12); // Approximation\nconst YEAR = DAY * 365;\n\nfunction getRelativeTimeFormatConfig(seconds: number) {\n const absValue = Math.abs(seconds);\n let value, unit: Intl.RelativeTimeFormatUnit;\n\n // We have to round the resulting values, as `Intl.RelativeTimeFormat`\n // will include fractions like '2.1 hours ago'.\n\n if (absValue < MINUTE) {\n unit = 'second';\n value = Math.round(seconds);\n } else if (absValue < HOUR) {\n unit = 'minute';\n value = Math.round(seconds / MINUTE);\n } else if (absValue < DAY) {\n unit = 'hour';\n value = Math.round(seconds / HOUR);\n } else if (absValue < WEEK) {\n unit = 'day';\n value = Math.round(seconds / DAY);\n } else if (absValue < MONTH) {\n unit = 'week';\n value = Math.round(seconds / WEEK);\n } else if (absValue < YEAR) {\n unit = 'month';\n value = Math.round(seconds / MONTH);\n } else {\n unit = 'year';\n value = Math.round(seconds / YEAR);\n }\n\n return {value, unit};\n}\n\ntype Props = {\n locale: string;\n timeZone?: TimeZone;\n onError?(error: IntlError): void;\n formats?: Partial<Formats>;\n now?: Date;\n};\n\nexport default function createFormatter({\n formats,\n locale,\n now: globalNow,\n onError = defaultOnError,\n timeZone\n}: Props) {\n function resolveFormatOrOptions<Options>(\n typeFormats: Record<string, Options> | undefined,\n formatOrOptions?: string | Options\n ) {\n let options;\n if (typeof formatOrOptions === 'string') {\n const formatName = formatOrOptions;\n options = typeFormats?.[formatName];\n\n if (!options) {\n const error = new IntlError(\n IntlErrorCode.MISSING_FORMAT,\n process.env.NODE_ENV !== 'production'\n ? `Format \\`${formatName}\\` is not available. You can configure it on the provider or provide custom options.`\n : undefined\n );\n onError(error);\n throw error;\n }\n } else {\n options = formatOrOptions;\n }\n\n return options;\n }\n\n function getFormattedValue<Value, Options>(\n value: Value,\n formatOrOptions: string | Options | undefined,\n typeFormats: Record<string, Options> | undefined,\n formatter: (options?: Options) => string\n ) {\n let options;\n try {\n options = resolveFormatOrOptions(typeFormats, formatOrOptions);\n } catch (error) {\n return String(value);\n }\n\n try {\n return formatter(options);\n } catch (error) {\n onError(\n new IntlError(IntlErrorCode.FORMATTING_ERROR, (error as Error).message)\n );\n return String(value);\n }\n }\n\n function dateTime(\n /** If a number is supplied, this is interpreted as a UTC timestamp. */\n value: Date | number,\n /** If a time zone is supplied, the `value` is converted to that time zone.\n * Otherwise the user time zone will be used. */\n formatOrOptions?: string | DateTimeFormatOptions\n ) {\n return getFormattedValue(\n value,\n formatOrOptions,\n formats?.dateTime,\n (options) => {\n if (timeZone && !options?.timeZone) {\n options = {...options, timeZone};\n }\n\n return new Intl.DateTimeFormat(locale, options).format(value);\n }\n );\n }\n\n function number(\n value: number | bigint,\n formatOrOptions?: string | NumberFormatOptions\n ) {\n return getFormattedValue(\n value,\n formatOrOptions,\n formats?.number,\n (options) => new Intl.NumberFormat(locale, options).format(value)\n );\n }\n\n function relativeTime(\n /** The date time that needs to be formatted. */\n date: number | Date,\n /** The reference point in time to which `date` will be formatted in relation to. */\n now?: number | Date\n ) {\n try {\n if (!now) {\n if (globalNow) {\n now = globalNow;\n } else {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `The \\`now\\` parameter wasn't provided and there was no global fallback configured on the provider.`\n : undefined\n );\n }\n }\n\n const dateDate = date instanceof Date ? date : new Date(date);\n const nowDate = now instanceof Date ? now : new Date(now);\n\n const seconds = (dateDate.getTime() - nowDate.getTime()) / 1000;\n const {unit, value} = getRelativeTimeFormatConfig(seconds);\n\n return new Intl.RelativeTimeFormat(locale, {\n numeric: 'auto'\n }).format(value, unit);\n } catch (error) {\n onError(\n new IntlError(IntlErrorCode.FORMATTING_ERROR, (error as Error).message)\n );\n return String(date);\n }\n }\n\n function list(\n value: Iterable<string>,\n formatOrOptions?: string | Intl.ListFormatOptions\n ) {\n return getFormattedValue(value, formatOrOptions, formats?.list, (options) =>\n new Intl.ListFormat(locale, options).format(value)\n );\n }\n\n return {dateTime, number, relativeTime, list};\n}\n","import createFormatter from './createFormatter';\n\n/** @deprecated Switch to `createFormatter` */\nexport default function createIntl(\n ...args: Parameters<typeof createFormatter>\n) {\n const formatter = createFormatter(...args);\n return {\n formatDateTime: formatter.dateTime,\n formatNumber: formatter.number,\n formatRelativeTime: formatter.relativeTime\n };\n}\n","import IntlConfig from './IntlConfig';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport validateMessages from './validateMessages';\n\n/**\n * Enhances the incoming props with defaults.\n */\nexport default function initializeConfig<\n // This is a generic to allow for stricter typing. E.g.\n // the RSC integration always provides a `now` value.\n Props extends Omit<IntlConfig, 'children'>\n>({getMessageFallback, messages, onError, ...rest}: Props) {\n const finalOnError = onError || defaultOnError;\n const finalGetMessageFallback =\n getMessageFallback || defaultGetMessageFallback;\n\n if (process.env.NODE_ENV !== 'production') {\n if (messages) {\n validateMessages(messages, finalOnError);\n }\n }\n\n return {\n ...rest,\n messages,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback\n };\n}\n","/**\n * For the strictly typed messages to work we have to wrap the namespace into\n * a mandatory prefix. See https://stackoverflow.com/a/71529575/343045\n */\nexport default function resolveNamespace(\n namespace: string,\n namespacePrefix: string\n) {\n return namespace === namespacePrefix\n ? undefined\n : namespace.slice((namespacePrefix + '.').length);\n}\n"],"names":["IntlErrorCode","IntlError","_Error","code","originalMessage","_this","message","call","this","_wrapNativeSuper","Error","setTimeZoneInFormats","formats","timeZone","Object","keys","reduce","acc","key","_extends","defaultGetMessageFallback","props","namespace","filter","part","join","defaultOnError","error","console","resolvePath","messages","undefined","split","forEach","next","DAY","HOUR","WEEK","MONTH","YEAR","createFormatter","_ref","locale","globalNow","now","_ref$onError","onError","getFormattedValue","value","formatOrOptions","typeFormats","formatter","options","MISSING_FORMAT","resolveFormatOrOptions","String","FORMATTING_ERROR","dateTime","_options","Intl","DateTimeFormat","format","number","NumberFormat","relativeTime","date","dateDate","Date","nowDate","_getRelativeTimeForma","seconds","unit","absValue","Math","abs","round","MINUTE","getRelativeTimeFormatConfig","getTime","RelativeTimeFormat","numeric","list","ListFormat","config","_ref2","defaultTranslationValues","globalFormats","_ref2$getMessageFallb","getMessageFallback","messageFormatCache","messagesOrError","getFallbackFromErrorAndNotify","translateBaseFn","values","MISSING_MESSAGE","messageFormat","cacheKey","has","get","Array","isArray","INVALID_MESSAGE","INSUFFICIENT_PATH","errorMessage","plainMessage","candidate","unescapedMessage","replace","test","getPlainMessage","IntlMessageFormat","formatsWithTimeZone","mfDateDefaults","defaultDateFormats","mfTimeDefaults","time","defaultTimeFormats","convertFormatsToIntlMessageFormat","set","formattedMessage","length","transformedValues","index","chunks","result","isValidElement","cloneElement","prepareTranslationValues","translateFn","rich","raw","createBaseTranslatorImpl","retrievedMessages","intlError","getMessagesOrError","apply","arguments","formatDateTime","formatNumber","formatRelativeTime","_objectWithoutPropertiesLoose","_excluded","namespacePrefix","slice"],"mappings":"gJAAYA,yhDAAAA,QAOXA,mBAAA,GAPWA,EAAAA,wBAAAA,QAAAA,cAOX,CAAA,IANC,gBAAA,kBACAA,EAAA,eAAA,iBACAA,EAAA,kBAAA,oBACAA,EAAA,gBAAA,kBACAA,EAAA,YAAA,cACAA,EAAA,iBAAA,mBAGmBC,IAAAA,WAAUC,WAI7B,SAAAD,EAAYE,EAAqBC,GAAwB,IAAAC,EACnDC,EAAkBH,EASrB,OARGC,IACFE,GAAW,KAAOF,IAEpBC,EAAAH,EAAAK,KAAAC,KAAMF,IAAQE,MARAL,UAAI,EAAAE,EACJD,qBAAe,EAS7BC,EAAKF,KAAOA,EACRC,IACFC,EAAKD,gBAAkBA,GACxBC,CACH,CAAC,SAf4BH,KAAAD,yEAe5BA,CAAA,EAAAQ,EAfoCC,QCHvC,SAASC,EACPC,EACAC,GAEA,OAAKD,EAIEE,OAAOC,KAAKH,GAASI,QAC1B,SAACC,EAA4CC,GAK3C,OAJAD,EAAIC,GAAIC,EAAA,CACNN,SAAAA,GACGD,EAAQM,IAEND,CACR,GACD,CAAE,GAZiBL,CAcvB,CCjBM,SAAUQ,EAA0BC,GAKxC,MAAO,CAACA,EAAMC,UAAWD,EAAMH,KAAKK,QAAO,SAACC,G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AM,CACTO,gBA7EJ,SAA2BjD,GAQ1B,IAPCX,EAAQW,EAARX,SACAR,EAASmB,EAATnB,UAASuB,EAAAJ,EACTK,QAAAA,OAAUpB,IAAHmB,EAAGnB,EAAcmB,EAMxB,IACE,IAAKf,EACH,MAAM,IAAIpB,WAGJqB,GAIR,IAAMqG,EAAoB9G,EACtBO,EAAYC,EAAUR,GACtBQ,EAEJ,IAAKsG,EACH,MAAM,IAAI1H,WAGJqB,GAIR,OAAOqG,CACR,CAAC,MAAOzG,GACP,IAAM0G,EAAY,IAAIpI,EACpBD,QAAAA,cAAc8F,gBACbnE,EAAgBrB,SAGnB,OADAwC,EAAQuF,GACDA,CACR,CACH,CA8B0BC,CAAmB,CACzCxG,SAAUqD,EAAOrD,SACjBR,UAAW6D,EAAO7D,UAClBwB,QAASqC,EAAOrC,YAOpB,+CE/Jc,WAGZ,IAAMK,EAAYX,EAAe+F,WAAA,EAAAC,WACjC,MAAO,CACLC,eAAgBtF,EAAUM,SAC1BiF,aAAcvF,EAAUW,OACxB6E,mBAAoBxF,EAAUa,aAElC,wFCLwB,SAAgBvB,GAIiB,IAAtD+C,EAAkB/C,EAAlB+C,mBAAoB1D,EAAQW,EAARX,SAAUgB,EAAOL,EAAPK,QAW/B,OAAA3B,KAX+CyH,EAAAnG,EAAAoG,GAYtC,CACP/G,SAAAA,EACAgB,QAbmBA,GAAWpB,EAc9B8D,mBAZAA,GAAsBpE,GAc1B,2BCxBc,SACZE,EACAwH,GAEA,OAAOxH,IAAcwH,OACjB/G,EACAT,EAAUyH,OAAOD,EAAkB,KAAKtB,OAC9C"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
declare const IntlContext: import("react").Context<
|
|
2
|
+
import MessageFormatCache from '../core/MessageFormatCache';
|
|
3
|
+
declare const IntlContext: import("react").Context<(import("../core/IntlConfig").default<import("../core/AbstractIntlMessages").default> & {
|
|
4
|
+
onError: (error: import("..").IntlError) => void;
|
|
5
|
+
getMessageFallback: (info: {
|
|
6
|
+
error: import("..").IntlError;
|
|
7
|
+
key: string;
|
|
8
|
+
namespace?: string | undefined;
|
|
9
|
+
}) => string;
|
|
10
|
+
} & {
|
|
11
|
+
messageFormatCache?: MessageFormatCache | undefined;
|
|
12
|
+
}) | undefined>;
|
|
4
13
|
export default IntlContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlContext.esm.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport {InitializedIntlConfig} from '../core/IntlConfig';\n\nconst IntlContext = createContext
|
|
1
|
+
{"version":3,"file":"IntlContext.esm.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport {InitializedIntlConfig} from '../core/IntlConfig';\nimport MessageFormatCache from '../core/MessageFormatCache';\n\nconst IntlContext = createContext<\n | (InitializedIntlConfig & {\n messageFormatCache?: MessageFormatCache;\n })\n | undefined\n>(undefined);\n\nexport default IntlContext;\n"],"names":["IntlContext","createContext","undefined"],"mappings":";;AAIA,IAAMA,WAAW,gBAAGC,aAAa,CAK/BC,SAAS;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/_rollupPluginBabelHelpers.esm.js';
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.esm.js';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import initializeConfig from '../core/initializeConfig.esm.js';
|
|
4
4
|
import IntlContext from './IntlContext.esm.js';
|
|
5
5
|
|
|
@@ -7,8 +7,14 @@ var _excluded = ["children"];
|
|
|
7
7
|
function IntlProvider(_ref) {
|
|
8
8
|
var children = _ref.children,
|
|
9
9
|
config = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
10
|
+
var _useState = useState(function () {
|
|
11
|
+
return new Map();
|
|
12
|
+
}),
|
|
13
|
+
messageFormatCache = _useState[0];
|
|
10
14
|
return React.createElement(IntlContext.Provider, {
|
|
11
|
-
value: initializeConfig(config)
|
|
15
|
+
value: _extends({}, initializeConfig(config), {
|
|
16
|
+
messageFormatCache: messageFormatCache
|
|
17
|
+
})
|
|
12
18
|
}, children);
|
|
13
19
|
}
|
|
14
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlProvider.esm.js","sources":["../../src/react/IntlProvider.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\nimport IntlConfig from '../core/IntlConfig';\nimport initializeConfig from '../core/initializeConfig';\nimport IntlContext from './IntlContext';\n\ntype Props = IntlConfig & {\n children: ReactNode;\n};\n\nexport default function IntlProvider({children, ...config}: Props) {\n return (\n <IntlContext.Provider
|
|
1
|
+
{"version":3,"file":"IntlProvider.esm.js","sources":["../../src/react/IntlProvider.tsx"],"sourcesContent":["import React, {ReactNode, useState} from 'react';\nimport IntlConfig from '../core/IntlConfig';\nimport initializeConfig from '../core/initializeConfig';\nimport IntlContext from './IntlContext';\n\ntype Props = IntlConfig & {\n children: ReactNode;\n};\n\nexport default function IntlProvider({children, ...config}: Props) {\n const [messageFormatCache] = useState(() => new Map());\n\n return (\n <IntlContext.Provider\n value={{\n ...initializeConfig(config),\n messageFormatCache\n }}\n >\n {children}\n </IntlContext.Provider>\n );\n}\n"],"names":["IntlProvider","_ref","children","config","_objectWithoutPropertiesLoose","_excluded","_useState","useState","Map","messageFormatCache","React","createElement","IntlContext","Provider","value","_extends","initializeConfig"],"mappings":";;;;;;AASc,SAAUA,YAAYA,CAAAC,IAAA,EAA6B;AAAA,EAAA,IAA3BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;AAAKC,IAAAA,MAAM,GAAAC,6BAAA,CAAAH,IAAA,EAAAI,SAAA,CAAA,CAAA;EACvD,IAAAC,SAAA,GAA6BC,QAAQ,CAAC,YAAA;MAAA,OAAM,IAAIC,GAAG,EAAE,CAAA;KAAC,CAAA;AAA/CC,IAAAA,kBAAkB,GAAAH,SAAA,CAAA,CAAA,CAAA,CAAA;AAEzB,EAAA,OACEI,KAAC,CAAAC,aAAA,CAAAC,WAAW,CAACC,QAAQ,EAAA;AACnBC,IAAAA,KAAK,EAAAC,QAAA,CAAA,EAAA,EACAC,gBAAgB,CAACb,MAAM,CAAC,EAAA;AAC3BM,MAAAA,kBAAkB,EAAlBA,kBAAAA;AAAkB,KAAA,CAAA;GAGnB,EAAAP,QAAQ,CACY,CAAA;AAE3B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm11.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport {InitializedIntlConfig} from '../core/IntlConfig';\n\nconst IntlContext = createContext
|
|
1
|
+
{"version":3,"file":"use-intl.esm11.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport {InitializedIntlConfig} from '../core/IntlConfig';\nimport MessageFormatCache from '../core/MessageFormatCache';\n\nconst IntlContext = createContext<\n | (InitializedIntlConfig & {\n messageFormatCache?: MessageFormatCache;\n })\n | undefined\n>(undefined);\n\nexport default IntlContext;\n"],"names":["IntlContext","createContext","undefined"],"mappings":";;AAIA,IAAMA,WAAW,gBAAGC,aAAa,CAK/BC,SAAS;;;;"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import createFormatter from '../core/use-intl.esm6.js';
|
|
3
1
|
import useIntlContext from './use-intl.esm10.js';
|
|
4
2
|
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
formats = _useIntlContext.formats,
|
|
8
|
-
locale = _useIntlContext.locale,
|
|
9
|
-
globalNow = _useIntlContext.now,
|
|
10
|
-
onError = _useIntlContext.onError,
|
|
11
|
-
timeZone = _useIntlContext.timeZone;
|
|
12
|
-
return useMemo(function () {
|
|
13
|
-
return createFormatter({
|
|
14
|
-
formats: formats,
|
|
15
|
-
locale: locale,
|
|
16
|
-
now: globalNow,
|
|
17
|
-
onError: onError,
|
|
18
|
-
timeZone: timeZone
|
|
19
|
-
});
|
|
20
|
-
}, [formats, globalNow, locale, onError, timeZone]);
|
|
3
|
+
function useLocale() {
|
|
4
|
+
return useIntlContext().locale;
|
|
21
5
|
}
|
|
22
6
|
|
|
23
|
-
export {
|
|
7
|
+
export { useLocale as default };
|
|
24
8
|
//# sourceMappingURL=use-intl.esm2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm2.js","sources":["../../src/react/
|
|
1
|
+
{"version":3,"file":"use-intl.esm2.js","sources":["../../src/react/useLocale.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useLocale() {\n return useIntlContext().locale;\n}\n"],"names":["useLocale","useIntlContext","locale"],"mappings":";;AAEc,SAAUA,SAASA,GAAA;AAC/B,EAAA,OAAOC,cAAc,EAAE,CAACC,MAAM,CAAA;AAChC;;;;"}
|