use-intl 3.17.0 → 3.17.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/development/_IntlProvider.js +1 -1
- package/dist/development/core.js +2 -2
- package/dist/development/{createFormatter-DMm1DTAO.js → createFormatter-D6te1ReQ.js} +2 -5
- package/dist/development/index.js +2 -2
- package/dist/development/{initializeConfig-SCqxwrIu.js → initializeConfig-DOn-8mVr.js} +0 -1
- package/dist/development/react.js +2 -2
- package/dist/types/src/core/createBaseTranslator.d.ts +3 -3
- package/dist/types/src/core/createFormatter.d.ts +1 -1
- package/dist/types/src/core/createTranslatorImpl.d.ts +3 -4
- package/dist/types/src/core/initializeConfig.d.ts +1 -1
- package/dist/types/src/react/IntlContext.d.ts +0 -1
- package/dist/types/src/react/useTranslationsImpl.d.ts +3 -4
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var initializeConfig = require('./initializeConfig-
|
|
6
|
+
var initializeConfig = require('./initializeConfig-DOn-8mVr.js');
|
|
7
7
|
var IntlContext = require('./IntlContext-BKfsnzBx.js');
|
|
8
8
|
require('@formatjs/fast-memoize');
|
|
9
9
|
require('intl-messageformat');
|
package/dist/development/core.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var initializeConfig = require('./initializeConfig-
|
|
6
|
-
var createFormatter = require('./createFormatter-
|
|
5
|
+
var initializeConfig = require('./initializeConfig-DOn-8mVr.js');
|
|
6
|
+
var createFormatter = require('./createFormatter-D6te1ReQ.js');
|
|
7
7
|
require('@formatjs/fast-memoize');
|
|
8
8
|
require('intl-messageformat');
|
|
9
9
|
require('react');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var initializeConfig = require('./initializeConfig-
|
|
4
|
+
var initializeConfig = require('./initializeConfig-DOn-8mVr.js');
|
|
5
5
|
var IntlMessageFormat = require('intl-messageformat');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -194,7 +194,6 @@ function createBaseTranslatorImpl(_ref) {
|
|
|
194
194
|
...globalFormats,
|
|
195
195
|
...formats
|
|
196
196
|
}, timeZone), {
|
|
197
|
-
// @ts-expect-error -- TS is currently lacking support for ECMA-402 10.0 (`useGrouping: 'auto'`, see https://github.com/microsoft/TypeScript/issues/56269)
|
|
198
197
|
formatters: {
|
|
199
198
|
...formatters,
|
|
200
199
|
getDateTimeFormat(locales, options) {
|
|
@@ -415,9 +414,7 @@ function createFormatter(_ref) {
|
|
|
415
414
|
}, () => [dateTime(start), dateTime(end)].join(' – '));
|
|
416
415
|
}
|
|
417
416
|
function number(value, formatOrOptions) {
|
|
418
|
-
return getFormattedValue(formatOrOptions, formats === null || formats === void 0 ? void 0 : formats.number,
|
|
419
|
-
// @ts-expect-error -- TS is currently lacking support for ECMA-402 10.0 (`useGrouping: 'auto'`, see https://github.com/microsoft/TypeScript/issues/56269)
|
|
420
|
-
options => formatters.getNumberFormat(locale, options).format(value), () => String(value));
|
|
417
|
+
return getFormattedValue(formatOrOptions, formats === null || formats === void 0 ? void 0 : formats.number, options => formatters.getNumberFormat(locale, options).format(value), () => String(value));
|
|
421
418
|
}
|
|
422
419
|
function getGlobalNow() {
|
|
423
420
|
if (globalNow) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var initializeConfig = require('./initializeConfig-
|
|
5
|
+
var initializeConfig = require('./initializeConfig-DOn-8mVr.js');
|
|
6
6
|
var core = require('./core.js');
|
|
7
|
-
var createFormatter = require('./createFormatter-
|
|
7
|
+
var createFormatter = require('./createFormatter-D6te1ReQ.js');
|
|
8
8
|
var _IntlProvider = require('./_IntlProvider.js');
|
|
9
9
|
var react = require('./react.js');
|
|
10
10
|
var _useLocale = require('./_useLocale-0Rl9uR82.js');
|
|
@@ -125,7 +125,6 @@ function createFormatters() {
|
|
|
125
125
|
const getMessageFormat = memoFn(function () {
|
|
126
126
|
return new IntlMessageFormat__default.default(arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2], {
|
|
127
127
|
formatters: {
|
|
128
|
-
// @ts-expect-error -- TS is currently lacking support for ECMA-402 10.0 (`useGrouping: 'auto'`, see https://github.com/microsoft/TypeScript/issues/56269)
|
|
129
128
|
getNumberFormat,
|
|
130
129
|
getDateTimeFormat,
|
|
131
130
|
getPluralRules
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _IntlProvider = require('./_IntlProvider.js');
|
|
6
6
|
var _useLocale = require('./_useLocale-0Rl9uR82.js');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var createFormatter = require('./createFormatter-
|
|
9
|
-
var initializeConfig = require('./initializeConfig-
|
|
8
|
+
var createFormatter = require('./createFormatter-D6te1ReQ.js');
|
|
9
|
+
var initializeConfig = require('./initializeConfig-DOn-8mVr.js');
|
|
10
10
|
require('./IntlContext-BKfsnzBx.js');
|
|
11
11
|
require('intl-messageformat');
|
|
12
12
|
require('@formatjs/fast-memoize');
|
|
@@ -15,8 +15,8 @@ export type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
|
|
|
15
15
|
messagesOrError: Messages | IntlError;
|
|
16
16
|
};
|
|
17
17
|
export default function createBaseTranslator<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(config: Omit<CreateBaseTranslatorProps<Messages>, 'messagesOrError'>): {
|
|
18
|
-
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues
|
|
19
|
-
rich: (key: string, values?: RichTranslationValues
|
|
20
|
-
markup(key: string, values: MarkupTranslationValues, formats?: Partial<Formats> |
|
|
18
|
+
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
19
|
+
rich: (key: string, values?: RichTranslationValues, formats?: Partial<Formats>) => string | ReactElement | ReactNodeArray;
|
|
20
|
+
markup(key: Parameters<(key: string, values?: RichTranslationValues, formats?: Partial<Formats>) => string | ReactElement | ReactNodeArray>[0], values: MarkupTranslationValues, formats?: Parameters<(key: string, values?: RichTranslationValues, formats?: Partial<Formats>) => string | ReactElement | ReactNodeArray>[2]): string;
|
|
21
21
|
raw(key: string): any;
|
|
22
22
|
};
|
|
@@ -18,7 +18,7 @@ type Props = {
|
|
|
18
18
|
export default function createFormatter({ _formatters: formatters, formats, locale, now: globalNow, onError, timeZone: globalTimeZone }: Props): {
|
|
19
19
|
dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
|
|
20
20
|
number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions) => string;
|
|
21
|
-
relativeTime: (date: number | Date, nowOrOptions?: RelativeTimeFormatOptions[
|
|
21
|
+
relativeTime: (date: number | Date, nowOrOptions?: RelativeTimeFormatOptions["now"] | RelativeTimeFormatOptions) => string;
|
|
22
22
|
list: <Value extends string | ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, formatOrOptions?: string | Intl.ListFormatOptions) => Value extends string ? string : Iterable<ReactElement>;
|
|
23
23
|
dateTimeRange: (start: Date | number, end: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
|
|
24
24
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import AbstractIntlMessages from './AbstractIntlMessages';
|
|
3
2
|
import { InitializedIntlConfig } from './IntlConfig';
|
|
4
3
|
import { Formatters } from './formatters';
|
|
@@ -9,8 +8,8 @@ export type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'm
|
|
|
9
8
|
formatters: Formatters;
|
|
10
9
|
};
|
|
11
10
|
export default function createTranslatorImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ messages, namespace, ...rest }: CreateTranslatorImplProps<Messages>, namespacePrefix: string): {
|
|
12
|
-
<TargetKey extends import(".").MessageKeys<import(".").NestedValueOf<Messages, NestedKey>, NestedKeyOf<import(".").NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: import("./TranslationValues").default
|
|
13
|
-
rich: (key: string, values?: import("./TranslationValues").RichTranslationValues
|
|
14
|
-
markup(key: string, values: import("./TranslationValues").MarkupTranslationValues, formats?: Partial<import("./Formats").default> |
|
|
11
|
+
<TargetKey extends import(".").MessageKeys<import(".").NestedValueOf<Messages, NestedKey>, NestedKeyOf<import(".").NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: import("./TranslationValues").default, formats?: Partial<import("./Formats").default>): string;
|
|
12
|
+
rich: (key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: Partial<import("./Formats").default>) => string | import("react").ReactElement | import("react").ReactNodeArray;
|
|
13
|
+
markup(key: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: Partial<import("./Formats").default>) => string | import("react").ReactElement | import("react").ReactNodeArray>[0], values: import("./TranslationValues").MarkupTranslationValues, formats?: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: Partial<import("./Formats").default>) => string | import("react").ReactElement | import("react").ReactNodeArray>[2]): string;
|
|
15
14
|
raw(key: string): any;
|
|
16
15
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import AbstractIntlMessages from '../core/AbstractIntlMessages';
|
|
3
2
|
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
4
3
|
export default function useTranslationsImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(allMessages: Messages, namespace: NestedKey, namespacePrefix: string): {
|
|
5
|
-
<TargetKey extends unknown>(key: TargetKey, values?: import("../core").TranslationValues
|
|
6
|
-
rich: (key: string, values?: import("../core").RichTranslationValues
|
|
7
|
-
markup(key: string, values: import("../core").MarkupTranslationValues, formats?: Partial<import("../core").Formats> |
|
|
4
|
+
<TargetKey extends unknown>(key: TargetKey, values?: import("../core").TranslationValues, formats?: Partial<import("../core").Formats>): string;
|
|
5
|
+
rich: (key: string, values?: import("../core").RichTranslationValues, formats?: Partial<import("../core").Formats>) => string | import("react").ReactElement | import("react").ReactNodeArray;
|
|
6
|
+
markup(key: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: Partial<import("../core").Formats>) => string | import("react").ReactElement | import("react").ReactNodeArray>[0], values: import("../core").MarkupTranslationValues, formats?: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: Partial<import("../core").Formats>) => string | import("react").ReactElement | import("react").ReactNodeArray>[2]): string;
|
|
8
7
|
raw(key: string): any;
|
|
9
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"description": "Internationalization (i18n) for React",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"limit": "15.545 kB"
|
|
76
76
|
}
|
|
77
77
|
],
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "b2117e10bab62c4b26cbd712551816a22a71e63f"
|
|
79
79
|
}
|