react-intl 6.5.2 → 6.5.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/package.json +9 -9
- package/react-intl.iife.js +32 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.3",
|
|
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",
|
|
@@ -132,16 +132,16 @@
|
|
|
132
132
|
"@types/react": "16 || 17 || 18",
|
|
133
133
|
"hoist-non-react-statics": "^3.3.2",
|
|
134
134
|
"tslib": "^2.4.0",
|
|
135
|
-
"@formatjs/
|
|
136
|
-
"@formatjs/
|
|
137
|
-
"@formatjs/intl": "2.9.
|
|
138
|
-
"@formatjs/
|
|
139
|
-
"@formatjs/intl-listformat": "7.5.
|
|
140
|
-
"intl-messageformat": "10.5.
|
|
135
|
+
"@formatjs/intl-displaynames": "6.6.3",
|
|
136
|
+
"@formatjs/ecma402-abstract": "1.17.4",
|
|
137
|
+
"@formatjs/intl": "2.9.7",
|
|
138
|
+
"@formatjs/icu-messageformat-parser": "2.7.2",
|
|
139
|
+
"@formatjs/intl-listformat": "7.5.2",
|
|
140
|
+
"intl-messageformat": "10.5.6"
|
|
141
141
|
},
|
|
142
142
|
"devDependencies": {
|
|
143
|
-
"@formatjs/intl-numberformat": "8.8.
|
|
144
|
-
"@formatjs/intl-relativetimeformat": "11.2.
|
|
143
|
+
"@formatjs/intl-numberformat": "8.8.2",
|
|
144
|
+
"@formatjs/intl-relativetimeformat": "11.2.9"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|
|
147
147
|
"react": "^16.6.0 || 17 || 18",
|
package/react-intl.iife.js
CHANGED
|
@@ -7181,23 +7181,34 @@ var ReactIntl = (() => {
|
|
|
7181
7181
|
return matchingDistance;
|
|
7182
7182
|
}
|
|
7183
7183
|
exports.findMatchingDistance = findMatchingDistance;
|
|
7184
|
-
function findBestMatch(
|
|
7184
|
+
function findBestMatch(requestedLocales, supportedLocales, threshold) {
|
|
7185
7185
|
if (threshold === void 0) {
|
|
7186
7186
|
threshold = DEFAULT_MATCHING_THRESHOLD;
|
|
7187
7187
|
}
|
|
7188
|
-
var bestMatch = void 0;
|
|
7189
7188
|
var lowestDistance = Infinity;
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7189
|
+
var result = {
|
|
7190
|
+
matchedDesiredLocale: "",
|
|
7191
|
+
distances: {}
|
|
7192
|
+
};
|
|
7193
|
+
requestedLocales.forEach(function(desired, i) {
|
|
7194
|
+
if (!result.distances[desired]) {
|
|
7195
|
+
result.distances[desired] = {};
|
|
7196
|
+
}
|
|
7197
|
+
supportedLocales.forEach(function(supported, j) {
|
|
7198
|
+
var distance = findMatchingDistance(desired, supported) + j + i * 40;
|
|
7199
|
+
result.distances[desired][supported] = distance;
|
|
7200
|
+
if (distance < lowestDistance) {
|
|
7201
|
+
lowestDistance = distance;
|
|
7202
|
+
result.matchedDesiredLocale = desired;
|
|
7203
|
+
result.matchedSupportedLocale = supported;
|
|
7204
|
+
}
|
|
7205
|
+
});
|
|
7196
7206
|
});
|
|
7197
7207
|
if (lowestDistance >= threshold) {
|
|
7198
|
-
|
|
7208
|
+
result.matchedDesiredLocale = void 0;
|
|
7209
|
+
result.matchedSupportedLocale = void 0;
|
|
7199
7210
|
}
|
|
7200
|
-
return
|
|
7211
|
+
return result;
|
|
7201
7212
|
}
|
|
7202
7213
|
exports.findBestMatch = findBestMatch;
|
|
7203
7214
|
}
|
|
@@ -7213,15 +7224,17 @@ var ReactIntl = (() => {
|
|
|
7213
7224
|
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
7214
7225
|
var foundLocale;
|
|
7215
7226
|
var extension;
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
var
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7227
|
+
var noExtensionLocales = [];
|
|
7228
|
+
var noExtensionLocaleMap = requestedLocales.reduce(function(all, l) {
|
|
7229
|
+
var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
7230
|
+
noExtensionLocales.push(noExtensionLocale);
|
|
7231
|
+
all[noExtensionLocale] = l;
|
|
7232
|
+
return all;
|
|
7233
|
+
}, {});
|
|
7234
|
+
var result = (0, utils_1.findBestMatch)(noExtensionLocales, availableLocales);
|
|
7235
|
+
if (result.matchedSupportedLocale && result.matchedDesiredLocale) {
|
|
7236
|
+
foundLocale = result.matchedSupportedLocale;
|
|
7237
|
+
extension = noExtensionLocaleMap[result.matchedDesiredLocale].slice(result.matchedDesiredLocale.length) || void 0;
|
|
7225
7238
|
}
|
|
7226
7239
|
if (!foundLocale) {
|
|
7227
7240
|
return { locale: getDefaultLocale() };
|