@lingui/core 4.1.2 → 4.2.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/dist/index.cjs +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const unraw = require('unraw');
|
|
3
4
|
const compileMessage = require('@lingui/message-utils/compileMessage');
|
|
4
5
|
|
|
5
6
|
const isString = (s) => typeof s === "string";
|
|
@@ -78,7 +79,7 @@ const getDefaultFormats = (locale, locales, formats = {}) => {
|
|
|
78
79
|
const message = plural(locales, true, value, cases);
|
|
79
80
|
return replaceOctothorpe(value - offset, message);
|
|
80
81
|
},
|
|
81
|
-
select: (value, rules) => rules[value]
|
|
82
|
+
select: (value, rules) => rules[value] ?? rules.other,
|
|
82
83
|
number: (value, format) => number(locales, value, style(format)),
|
|
83
84
|
date: (value, format) => date(locales, value, style(format)),
|
|
84
85
|
undefined: (value) => value
|
|
@@ -109,8 +110,9 @@ function interpolate(translation, locale, locales) {
|
|
|
109
110
|
}, "");
|
|
110
111
|
};
|
|
111
112
|
const result = formatMessage(translation);
|
|
112
|
-
if (isString(result) && UNICODE_REGEX.test(result))
|
|
113
|
-
return
|
|
113
|
+
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
114
|
+
return unraw(result.trim());
|
|
115
|
+
}
|
|
114
116
|
if (isString(result))
|
|
115
117
|
return result.trim();
|
|
116
118
|
return result;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import unraw from 'unraw';
|
|
1
2
|
import { compileMessage } from '@lingui/message-utils/compileMessage';
|
|
2
3
|
|
|
3
4
|
const isString = (s) => typeof s === "string";
|
|
@@ -76,7 +77,7 @@ const getDefaultFormats = (locale, locales, formats = {}) => {
|
|
|
76
77
|
const message = plural(locales, true, value, cases);
|
|
77
78
|
return replaceOctothorpe(value - offset, message);
|
|
78
79
|
},
|
|
79
|
-
select: (value, rules) => rules[value]
|
|
80
|
+
select: (value, rules) => rules[value] ?? rules.other,
|
|
80
81
|
number: (value, format) => number(locales, value, style(format)),
|
|
81
82
|
date: (value, format) => date(locales, value, style(format)),
|
|
82
83
|
undefined: (value) => value
|
|
@@ -107,8 +108,9 @@ function interpolate(translation, locale, locales) {
|
|
|
107
108
|
}, "");
|
|
108
109
|
};
|
|
109
110
|
const result = formatMessage(translation);
|
|
110
|
-
if (isString(result) && UNICODE_REGEX.test(result))
|
|
111
|
-
return
|
|
111
|
+
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
112
|
+
return unraw(result.trim());
|
|
113
|
+
}
|
|
112
114
|
if (isString(result))
|
|
113
115
|
return result.trim();
|
|
114
116
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/core",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "I18n tools for javascript",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -54,11 +54,12 @@
|
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@babel/runtime": "^7.20.13",
|
|
57
|
-
"@lingui/message-utils": "4.1
|
|
57
|
+
"@lingui/message-utils": "4.2.1",
|
|
58
|
+
"unraw": "^2.0.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@lingui/jest-mocks": "*",
|
|
61
62
|
"unbuild": "^1.1.2"
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "9e0cd185ec372aab1d2df937e02cec2b31e73c10"
|
|
64
65
|
}
|