use-intl 2.10.1 → 2.10.3
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/use-intl.esm3.js +2 -2
- package/dist/core/use-intl.esm3.js.map +1 -1
- package/dist/core/use-intl.esm4.js +1 -1
- package/dist/core/use-intl.esm4.js.map +1 -1
- package/dist/core/use-intl.esm7.js +7 -7
- package/dist/core/use-intl.esm7.js.map +1 -1
- package/dist/react/use-intl.esm.js +1 -1
- package/dist/react/use-intl.esm.js.map +1 -1
- package/dist/react/use-intl.esm8.js +1 -1
- package/dist/react/use-intl.esm8.js.map +1 -1
- package/dist/src/core/createBaseTranslator.js +11 -7
- package/dist/src/core/createBaseTranslator.js.map +1 -1
- package/dist/src/core/createIntl.js +2 -2
- package/dist/src/core/createIntl.js.map +1 -1
- package/dist/src/core/createTranslatorImpl.js +1 -1
- package/dist/src/core/createTranslatorImpl.js.map +1 -1
- package/dist/src/react/IntlProvider.js +1 -1
- package/dist/src/react/IntlProvider.js.map +1 -1
- package/dist/src/react/useIntlContext.js +1 -1
- package/dist/src/react/useIntlContext.js.map +1 -1
- package/dist/use-intl.cjs.development.js +4 -4
- package/dist/use-intl.cjs.development.js.map +1 -1
- package/dist/use-intl.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/src/core/createBaseTranslator.tsx +11 -7
- package/src/core/createIntl.tsx +2 -2
- package/src/core/createTranslatorImpl.tsx +1 -1
- package/src/react/IntlProvider.tsx +1 -1
- package/src/react/useIntlContext.tsx +1 -1
|
@@ -24,7 +24,9 @@ function resolvePath(
|
|
|
24
24
|
) {
|
|
25
25
|
if (!messages) {
|
|
26
26
|
throw new Error(
|
|
27
|
-
|
|
27
|
+
process.env.NODE_ENV !== 'production'
|
|
28
|
+
? `No messages available at \`${namespace}\`.`
|
|
29
|
+
: undefined
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
32
|
|
|
@@ -35,7 +37,7 @@ function resolvePath(
|
|
|
35
37
|
|
|
36
38
|
if (part == null || next == null) {
|
|
37
39
|
throw new Error(
|
|
38
|
-
|
|
40
|
+
process.env.NODE_ENV !== 'production'
|
|
39
41
|
? `Could not resolve \`${key}\` in ${
|
|
40
42
|
namespace ? `\`${namespace}\`` : 'messages'
|
|
41
43
|
}.`
|
|
@@ -89,7 +91,9 @@ export function getMessagesOrError<Messages extends AbstractIntlMessages>({
|
|
|
89
91
|
try {
|
|
90
92
|
if (!messages) {
|
|
91
93
|
throw new Error(
|
|
92
|
-
|
|
94
|
+
process.env.NODE_ENV !== 'production'
|
|
95
|
+
? `No messages were configured on the provider.`
|
|
96
|
+
: undefined
|
|
93
97
|
);
|
|
94
98
|
}
|
|
95
99
|
|
|
@@ -99,7 +103,7 @@ export function getMessagesOrError<Messages extends AbstractIntlMessages>({
|
|
|
99
103
|
|
|
100
104
|
if (!retrievedMessages) {
|
|
101
105
|
throw new Error(
|
|
102
|
-
|
|
106
|
+
process.env.NODE_ENV !== 'production'
|
|
103
107
|
? `No messages for namespace \`${namespace}\` found.`
|
|
104
108
|
: undefined
|
|
105
109
|
);
|
|
@@ -187,7 +191,7 @@ export default function createBaseTranslator<
|
|
|
187
191
|
return getFallbackFromErrorAndNotify(
|
|
188
192
|
key,
|
|
189
193
|
IntlErrorCode.INSUFFICIENT_PATH,
|
|
190
|
-
|
|
194
|
+
process.env.NODE_ENV !== 'production'
|
|
191
195
|
? `Insufficient path specified for \`${key}\` in \`${
|
|
192
196
|
namespace ? `\`${namespace}\`` : 'messages'
|
|
193
197
|
}\`.`
|
|
@@ -231,7 +235,7 @@ export default function createBaseTranslator<
|
|
|
231
235
|
|
|
232
236
|
if (formattedMessage == null) {
|
|
233
237
|
throw new Error(
|
|
234
|
-
|
|
238
|
+
process.env.NODE_ENV !== 'production'
|
|
235
239
|
? `Unable to format \`${key}\` in ${
|
|
236
240
|
namespace ? `namespace \`${namespace}\`` : 'messages'
|
|
237
241
|
}`
|
|
@@ -274,7 +278,7 @@ export default function createBaseTranslator<
|
|
|
274
278
|
return getFallbackFromErrorAndNotify(
|
|
275
279
|
key,
|
|
276
280
|
IntlErrorCode.INVALID_MESSAGE,
|
|
277
|
-
|
|
281
|
+
process.env.NODE_ENV !== 'production'
|
|
278
282
|
? `The message \`${key}\` in ${
|
|
279
283
|
namespace ? `namespace \`${namespace}\`` : 'messages'
|
|
280
284
|
} didn't resolve to a string. If you want to format rich text, use \`t.rich\` instead.`
|
package/src/core/createIntl.tsx
CHANGED
|
@@ -71,7 +71,7 @@ export default function createIntl({
|
|
|
71
71
|
if (!options) {
|
|
72
72
|
const error = new IntlError(
|
|
73
73
|
IntlErrorCode.MISSING_FORMAT,
|
|
74
|
-
|
|
74
|
+
process.env.NODE_ENV !== 'production'
|
|
75
75
|
? `Format \`${formatName}\` is not available. You can configure it on the provider or provide custom options.`
|
|
76
76
|
: undefined
|
|
77
77
|
);
|
|
@@ -153,7 +153,7 @@ export default function createIntl({
|
|
|
153
153
|
now = globalNow;
|
|
154
154
|
} else {
|
|
155
155
|
throw new Error(
|
|
156
|
-
|
|
156
|
+
process.env.NODE_ENV !== 'production'
|
|
157
157
|
? `The \`now\` parameter wasn't provided to \`formatRelativeTime\` and there was no global fallback configured on the provider.`
|
|
158
158
|
: undefined
|
|
159
159
|
);
|
|
@@ -67,7 +67,7 @@ export default function createTranslatorImpl<
|
|
|
67
67
|
if (typeof result !== 'string') {
|
|
68
68
|
const error = new IntlError(
|
|
69
69
|
IntlErrorCode.FORMATTING_ERROR,
|
|
70
|
-
|
|
70
|
+
process.env.NODE_ENV !== 'production'
|
|
71
71
|
? "`createTranslator` only accepts functions for rich text formatting that receive and return strings.\n\nE.g. t.rich('rich', {b: (chunks) => `<b>${chunks}</b>`})"
|
|
72
72
|
: undefined
|
|
73
73
|
);
|