intl-messageformat 10.6.0 → 10.7.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 +217 -173
- package/intl-messageformat.iife.js +384 -382
- package/lib/src/core.d.ts +2 -2
- package/lib/src/core.js +1 -1
- package/package.json +5 -5
- package/src/core.d.ts +2 -2
- package/src/core.js +1 -1
- package/src/formatters.js +3 -3
package/lib/src/core.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export declare class IntlMessageFormat {
|
|
|
12
12
|
private readonly message;
|
|
13
13
|
private readonly formatterCache;
|
|
14
14
|
constructor(message: string | MessageFormatElement[], locales?: string | string[], overrideFormats?: Partial<Formats>, opts?: Options);
|
|
15
|
-
format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>
|
|
16
|
-
formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>
|
|
15
|
+
format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => string | T | (string | T)[];
|
|
16
|
+
formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => MessageFormatPart<T>[];
|
|
17
17
|
resolvedOptions: () => {
|
|
18
18
|
locale: string;
|
|
19
19
|
};
|
package/lib/src/core.js
CHANGED
|
@@ -84,8 +84,8 @@ function createDefaultFormatters(cache) {
|
|
|
84
84
|
}
|
|
85
85
|
var IntlMessageFormat = /** @class */ (function () {
|
|
86
86
|
function IntlMessageFormat(message, locales, overrideFormats, opts) {
|
|
87
|
-
var _this = this;
|
|
88
87
|
if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
|
|
88
|
+
var _this = this;
|
|
89
89
|
this.formatterCache = {
|
|
90
90
|
number: {},
|
|
91
91
|
dateTime: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intl-messageformat",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.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
|
-
"tslib": "^2.
|
|
35
|
-
"@formatjs/ecma402-abstract": "2.
|
|
36
|
-
"@formatjs/icu-messageformat-parser": "2.
|
|
37
|
-
"@formatjs/fast-memoize": "2.2.
|
|
34
|
+
"tslib": "^2.7.0",
|
|
35
|
+
"@formatjs/ecma402-abstract": "2.2.0",
|
|
36
|
+
"@formatjs/icu-messageformat-parser": "2.8.0",
|
|
37
|
+
"@formatjs/fast-memoize": "2.2.1"
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"homepage": "https://github.com/formatjs/formatjs",
|
package/src/core.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export declare class IntlMessageFormat {
|
|
|
12
12
|
private readonly message;
|
|
13
13
|
private readonly formatterCache;
|
|
14
14
|
constructor(message: string | MessageFormatElement[], locales?: string | string[], overrideFormats?: Partial<Formats>, opts?: Options);
|
|
15
|
-
format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>
|
|
16
|
-
formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>
|
|
15
|
+
format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => string | T | (string | T)[];
|
|
16
|
+
formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => MessageFormatPart<T>[];
|
|
17
17
|
resolvedOptions: () => {
|
|
18
18
|
locale: string;
|
|
19
19
|
};
|
package/src/core.js
CHANGED
|
@@ -87,8 +87,8 @@ function createDefaultFormatters(cache) {
|
|
|
87
87
|
}
|
|
88
88
|
var IntlMessageFormat = /** @class */ (function () {
|
|
89
89
|
function IntlMessageFormat(message, locales, overrideFormats, opts) {
|
|
90
|
-
var _this = this;
|
|
91
90
|
if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
|
|
91
|
+
var _this = this;
|
|
92
92
|
this.formatterCache = {
|
|
93
93
|
number: {},
|
|
94
94
|
dateTime: {},
|
package/src/formatters.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PART_TYPE = void 0;
|
|
4
|
+
exports.isFormatXMLElementFn = isFormatXMLElementFn;
|
|
5
|
+
exports.formatToParts = formatToParts;
|
|
4
6
|
var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
|
|
5
7
|
var error_1 = require("./error");
|
|
6
8
|
var PART_TYPE;
|
|
@@ -28,7 +30,6 @@ function mergeLiteral(parts) {
|
|
|
28
30
|
function isFormatXMLElementFn(el) {
|
|
29
31
|
return typeof el === 'function';
|
|
30
32
|
}
|
|
31
|
-
exports.isFormatXMLElementFn = isFormatXMLElementFn;
|
|
32
33
|
// TODO(skeleton): add skeleton support
|
|
33
34
|
function formatToParts(els, locales, formatters, formats, values, currentPluralValue,
|
|
34
35
|
// For debugging
|
|
@@ -179,4 +180,3 @@ originalMessage) {
|
|
|
179
180
|
}
|
|
180
181
|
return mergeLiteral(result);
|
|
181
182
|
}
|
|
182
|
-
exports.formatToParts = formatToParts;
|