react-intl 3.9.1 → 3.9.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/CHANGELOG.md +8 -0
- package/dist/formatters/list.d.ts +1 -2
- package/dist/react-intl.api.md +2 -0
- package/dist/react-intl.d.ts +1 -0
- package/dist/react-intl.js +1 -1
- package/dist/react-intl.js.map +1 -1
- package/dist/react-intl.min.js +1 -1
- package/dist/react-intl.min.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/lib/formatters/list.d.ts +1 -2
- package/lib/react-intl.d.ts +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +16 -16
- package/src/formatters/list.ts +7 -1
- package/src/types.ts +4 -0
package/dist/types.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface IntlFormatters {
|
|
|
37
37
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): string;
|
|
38
38
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | React.ReactElement | FormatXMLElementFn>): string | React.ReactNodeArray;
|
|
39
39
|
formatHTMLMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): React.ReactNode;
|
|
40
|
+
formatList(values: Array<string>, opts?: FormatListOptions): string;
|
|
40
41
|
formatList(values: Array<string | React.ReactNode>, opts?: FormatListOptions): React.ReactNode;
|
|
41
42
|
}
|
|
42
43
|
export interface Formatters {
|
package/lib/formatters/list.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { IntlConfig, Formatters, IntlFormatters } from '../types';
|
|
3
|
-
export declare function formatList({ locale, onError }: Pick<IntlConfig, 'locale' | 'onError'>, getListFormat: Formatters['getListFormat'], values:
|
|
2
|
+
export declare function formatList({ locale, onError }: Pick<IntlConfig, 'locale' | 'onError'>, getListFormat: Formatters['getListFormat'], values: Array<string>, options: Parameters<IntlFormatters['formatList']>[1]): string;
|
package/lib/react-intl.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ export declare interface IntlFormatters {
|
|
|
169
169
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): string;
|
|
170
170
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | React.ReactElement | FormatXMLElementFn>): string | React.ReactNodeArray;
|
|
171
171
|
formatHTMLMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): React.ReactNode;
|
|
172
|
+
formatList(values: Array<string>, opts?: FormatListOptions): string;
|
|
172
173
|
formatList(values: Array<string | React.ReactNode>, opts?: FormatListOptions): React.ReactNode;
|
|
173
174
|
}
|
|
174
175
|
|
package/lib/tsdoc-metadata.json
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface IntlFormatters {
|
|
|
37
37
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): string;
|
|
38
38
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | React.ReactElement | FormatXMLElementFn>): string | React.ReactNodeArray;
|
|
39
39
|
formatHTMLMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): React.ReactNode;
|
|
40
|
+
formatList(values: Array<string>, opts?: FormatListOptions): string;
|
|
40
41
|
formatList(values: Array<string | React.ReactNode>, opts?: FormatListOptions): React.ReactNode;
|
|
41
42
|
}
|
|
42
43
|
export interface Formatters {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -140,35 +140,35 @@
|
|
|
140
140
|
"hoist-non-react-statics": "^3.3.1",
|
|
141
141
|
"intl-format-cache": "^4.2.13",
|
|
142
142
|
"intl-locales-supported": "^1.8.4",
|
|
143
|
-
"intl-messageformat": "^7.7.
|
|
144
|
-
"intl-messageformat-parser": "^3.5.
|
|
143
|
+
"intl-messageformat": "^7.7.2",
|
|
144
|
+
"intl-messageformat-parser": "^3.5.1",
|
|
145
145
|
"invariant": "^2.1.1",
|
|
146
|
-
"shallow-equal": "^1.1
|
|
146
|
+
"shallow-equal": "^1.2.1"
|
|
147
147
|
},
|
|
148
148
|
"peerDependencies": {
|
|
149
149
|
"react": "^16.3.0"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
|
-
"@babel/core": "^7.7.
|
|
152
|
+
"@babel/core": "^7.7.5",
|
|
153
153
|
"@babel/node": "^7.7.4",
|
|
154
154
|
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
|
155
|
-
"@babel/plugin-transform-modules-commonjs": "^7.7.
|
|
156
|
-
"@babel/preset-env": "^7.7.
|
|
155
|
+
"@babel/plugin-transform-modules-commonjs": "^7.7.5",
|
|
156
|
+
"@babel/preset-env": "^7.7.6",
|
|
157
157
|
"@babel/preset-react": "^7.7.4",
|
|
158
158
|
"@formatjs/intl-pluralrules": "^1.3.9",
|
|
159
|
-
"@microsoft/api-documenter": "^7.7.
|
|
160
|
-
"@microsoft/api-extractor": "^7.
|
|
159
|
+
"@microsoft/api-documenter": "^7.7.2",
|
|
160
|
+
"@microsoft/api-extractor": "^7.7.0",
|
|
161
161
|
"@types/benchmark": "^1.0.31",
|
|
162
|
-
"@types/enzyme": "^3.10.
|
|
162
|
+
"@types/enzyme": "^3.10.4",
|
|
163
163
|
"@types/jest": "^24.0.23",
|
|
164
164
|
"@types/prop-types": "^15.7.3",
|
|
165
|
-
"@types/react": "^16.9.
|
|
165
|
+
"@types/react": "^16.9.16",
|
|
166
166
|
"@types/react-dom": "^16.9.4",
|
|
167
|
-
"@typescript-eslint/eslint-plugin": "^2.
|
|
168
|
-
"@typescript-eslint/parser": "^2.
|
|
167
|
+
"@typescript-eslint/eslint-plugin": "^2.11.0",
|
|
168
|
+
"@typescript-eslint/parser": "^2.11.0",
|
|
169
169
|
"babel-jest": "^24.9.0",
|
|
170
170
|
"benchmark": "^2.1.0",
|
|
171
|
-
"core-js": "^3.4.
|
|
171
|
+
"core-js": "^3.4.8",
|
|
172
172
|
"cross-env": "^6.0.3",
|
|
173
173
|
"enzyme": "^3.6.0",
|
|
174
174
|
"enzyme-adapter-react-16": "^1.15.1",
|
|
@@ -187,12 +187,12 @@
|
|
|
187
187
|
"react": "^16.12.0",
|
|
188
188
|
"react-dom": "^16.12.0",
|
|
189
189
|
"rimraf": "^3.0.0",
|
|
190
|
-
"rollup": "^1.27.
|
|
190
|
+
"rollup": "^1.27.9",
|
|
191
191
|
"rollup-plugin-babel": "^4.3.3",
|
|
192
192
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
193
193
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
194
194
|
"rollup-plugin-replace": "^2.0.0",
|
|
195
|
-
"rollup-plugin-typescript2": "^0.25.
|
|
195
|
+
"rollup-plugin-typescript2": "^0.25.3",
|
|
196
196
|
"rollup-plugin-uglify": "^6.0.3",
|
|
197
197
|
"standard-version": "^7.0.1",
|
|
198
198
|
"ts-jest": "^24.2.0",
|
package/src/formatters/list.ts
CHANGED
|
@@ -15,12 +15,18 @@ function generateToken(i: number): string {
|
|
|
15
15
|
return `${now}_${i}_${now}`;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export function formatList(
|
|
19
|
+
{locale, onError}: Pick<IntlConfig, 'locale' | 'onError'>,
|
|
20
|
+
getListFormat: Formatters['getListFormat'],
|
|
21
|
+
values: Array<string>,
|
|
22
|
+
options: Parameters<IntlFormatters['formatList']>[1]
|
|
23
|
+
): string;
|
|
18
24
|
export function formatList(
|
|
19
25
|
{locale, onError}: Pick<IntlConfig, 'locale' | 'onError'>,
|
|
20
26
|
getListFormat: Formatters['getListFormat'],
|
|
21
27
|
values: Parameters<IntlFormatters['formatList']>[0],
|
|
22
28
|
options: Parameters<IntlFormatters['formatList']>[1] = {}
|
|
23
|
-
):
|
|
29
|
+
): React.ReactNode {
|
|
24
30
|
const ListFormat: typeof IntlListFormat = (Intl as any).ListFormat;
|
|
25
31
|
if (!ListFormat) {
|
|
26
32
|
onError(
|
package/src/types.ts
CHANGED
|
@@ -107,6 +107,10 @@ export interface IntlFormatters {
|
|
|
107
107
|
descriptor: MessageDescriptor,
|
|
108
108
|
values?: Record<string, PrimitiveType>
|
|
109
109
|
): React.ReactNode;
|
|
110
|
+
formatList(
|
|
111
|
+
values: Array<string>,
|
|
112
|
+
opts?: FormatListOptions
|
|
113
|
+
): string;
|
|
110
114
|
formatList(
|
|
111
115
|
values: Array<string | React.ReactNode>,
|
|
112
116
|
opts?: FormatListOptions
|