intl-messageformat 9.13.0 → 10.0.1
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/intl-messageformat.esm.js +3238 -2663
- package/intl-messageformat.iife.js +3290 -2754
- package/lib/src/core.d.ts +2 -2
- package/lib/src/core.d.ts.map +1 -1
- package/lib/src/core.js +10 -3
- package/package.json +5 -5
- package/src/core.d.ts +2 -2
- package/src/core.d.ts.map +1 -1
- package/src/core.js +10 -3
package/lib/src/core.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Options {
|
|
|
13
13
|
export declare class IntlMessageFormat {
|
|
14
14
|
private readonly ast;
|
|
15
15
|
private readonly locales;
|
|
16
|
-
private readonly resolvedLocale
|
|
16
|
+
private readonly resolvedLocale?;
|
|
17
17
|
private readonly formatters;
|
|
18
18
|
private readonly formats;
|
|
19
19
|
private readonly message;
|
|
@@ -27,7 +27,7 @@ export declare class IntlMessageFormat {
|
|
|
27
27
|
getAst: () => MessageFormatElement[];
|
|
28
28
|
private static memoizedDefaultLocale;
|
|
29
29
|
static get defaultLocale(): string;
|
|
30
|
-
static resolveLocale: (locales: string | string[]) => Intl.Locale;
|
|
30
|
+
static resolveLocale: (locales: string | string[]) => Intl.Locale | undefined;
|
|
31
31
|
static __parse: typeof parse | undefined;
|
|
32
32
|
static formats: Formats;
|
|
33
33
|
}
|
package/lib/src/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl-messageformat/src/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,EAAE,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAEL,UAAU,EACV,OAAO,EAEP,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAsCrB,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,UAAU,CAAA;IACv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,MAAM,KAAK,aAAa,WAOvB;IACD,MAAM,CAAC,aAAa,YACT,MAAM,GAAG,MAAM,EAAE,KACzB,KAAK,MAAM,GAAG,SAAS,CAUzB;IACD,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,SAAS,CAAQ;IAIhD,MAAM,CAAC,OAAO,EAAE,OAAO,CAmEtB;CACF"}
|
package/lib/src/core.js
CHANGED
|
@@ -116,9 +116,13 @@ var IntlMessageFormat = /** @class */ (function () {
|
|
|
116
116
|
this.formatToParts = function (values) {
|
|
117
117
|
return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);
|
|
118
118
|
};
|
|
119
|
-
this.resolvedOptions = function () {
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
this.resolvedOptions = function () {
|
|
120
|
+
var _a;
|
|
121
|
+
return ({
|
|
122
|
+
locale: ((_a = _this.resolvedLocale) === null || _a === void 0 ? void 0 : _a.toString()) ||
|
|
123
|
+
Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],
|
|
124
|
+
});
|
|
125
|
+
};
|
|
122
126
|
this.getAst = function () { return _this.ast; };
|
|
123
127
|
// Defined first because it's used to build the format pattern.
|
|
124
128
|
this.locales = locales;
|
|
@@ -159,6 +163,9 @@ var IntlMessageFormat = /** @class */ (function () {
|
|
|
159
163
|
});
|
|
160
164
|
IntlMessageFormat.memoizedDefaultLocale = null;
|
|
161
165
|
IntlMessageFormat.resolveLocale = function (locales) {
|
|
166
|
+
if (typeof Intl.Locale === 'undefined') {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
162
169
|
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
163
170
|
if (supportedLocales.length > 0) {
|
|
164
171
|
return new Intl.Locale(supportedLocales[0]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intl-messageformat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"module": "lib/index.js",
|
|
32
32
|
"types": "index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@formatjs/ecma402-abstract": "1.11.
|
|
35
|
-
"@formatjs/fast-memoize": "1.2.
|
|
36
|
-
"@formatjs/icu-messageformat-parser": "2.1.
|
|
37
|
-
"tslib": "
|
|
34
|
+
"@formatjs/ecma402-abstract": "1.11.6",
|
|
35
|
+
"@formatjs/fast-memoize": "1.2.3",
|
|
36
|
+
"@formatjs/icu-messageformat-parser": "2.1.2",
|
|
37
|
+
"tslib": "2.4.0"
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"homepage": "https://github.com/formatjs/formatjs",
|
package/src/core.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Options {
|
|
|
13
13
|
export declare class IntlMessageFormat {
|
|
14
14
|
private readonly ast;
|
|
15
15
|
private readonly locales;
|
|
16
|
-
private readonly resolvedLocale
|
|
16
|
+
private readonly resolvedLocale?;
|
|
17
17
|
private readonly formatters;
|
|
18
18
|
private readonly formats;
|
|
19
19
|
private readonly message;
|
|
@@ -27,7 +27,7 @@ export declare class IntlMessageFormat {
|
|
|
27
27
|
getAst: () => MessageFormatElement[];
|
|
28
28
|
private static memoizedDefaultLocale;
|
|
29
29
|
static get defaultLocale(): string;
|
|
30
|
-
static resolveLocale: (locales: string | string[]) => Intl.Locale;
|
|
30
|
+
static resolveLocale: (locales: string | string[]) => Intl.Locale | undefined;
|
|
31
31
|
static __parse: typeof parse | undefined;
|
|
32
32
|
static formats: Formats;
|
|
33
33
|
}
|
package/src/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-messageformat/src/core.ts"],"names":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GAAE,MAAM,GAAG,MAAM,EAAoC,EAC5D,eAAe,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAClC,IAAI,CAAC,EAAE,OAAO;IAkChB,MAAM,yJAyBL;IACD,aAAa,6IAWV;IACH,eAAe;;MAIb;IACF,MAAM,+BAAiB;IACvB,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAsB;IAE1D,MAAM,KAAK,aAAa,WAOvB;IACD,MAAM,CAAC,aAAa,YACT,MAAM,GAAG,MAAM,EAAE,KACzB,KAAK,MAAM,GAAG,SAAS,CAUzB;IACD,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,SAAS,CAAQ;IAIhD,MAAM,CAAC,OAAO,EAAE,OAAO,CAmEtB;CACF"}
|
package/src/core.js
CHANGED
|
@@ -119,9 +119,13 @@ var IntlMessageFormat = /** @class */ (function () {
|
|
|
119
119
|
this.formatToParts = function (values) {
|
|
120
120
|
return (0, formatters_1.formatToParts)(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);
|
|
121
121
|
};
|
|
122
|
-
this.resolvedOptions = function () {
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
this.resolvedOptions = function () {
|
|
123
|
+
var _a;
|
|
124
|
+
return ({
|
|
125
|
+
locale: ((_a = _this.resolvedLocale) === null || _a === void 0 ? void 0 : _a.toString()) ||
|
|
126
|
+
Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],
|
|
127
|
+
});
|
|
128
|
+
};
|
|
125
129
|
this.getAst = function () { return _this.ast; };
|
|
126
130
|
// Defined first because it's used to build the format pattern.
|
|
127
131
|
this.locales = locales;
|
|
@@ -162,6 +166,9 @@ var IntlMessageFormat = /** @class */ (function () {
|
|
|
162
166
|
});
|
|
163
167
|
IntlMessageFormat.memoizedDefaultLocale = null;
|
|
164
168
|
IntlMessageFormat.resolveLocale = function (locales) {
|
|
169
|
+
if (typeof Intl.Locale === 'undefined') {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
165
172
|
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
166
173
|
if (supportedLocales.length > 0) {
|
|
167
174
|
return new Intl.Locale(supportedLocales[0]);
|