@lingui/core 4.10.0 → 4.11.0

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 CHANGED
@@ -93,11 +93,11 @@ const selectFormatter = (value, rules) => rules[value] ?? rules.other;
93
93
  function interpolate(translation, locale, locales) {
94
94
  return (values = {}, formats) => {
95
95
  const formatters = getDefaultFormats(locale, locales, formats);
96
- const formatMessage = (tokens) => {
96
+ const formatMessage = (tokens, replaceOctothorpe = false) => {
97
97
  if (!Array.isArray(tokens))
98
98
  return tokens;
99
99
  return tokens.reduce((message, token) => {
100
- if (token === "#") {
100
+ if (token === "#" && replaceOctothorpe) {
101
101
  return message + OCTOTHORPE_PH;
102
102
  }
103
103
  if (isString(token)) {
@@ -108,7 +108,10 @@ function interpolate(translation, locale, locales) {
108
108
  if (type === "plural" || type === "selectordinal" || type === "select") {
109
109
  Object.entries(format).forEach(
110
110
  ([key, value2]) => {
111
- interpolatedFormat[key] = formatMessage(value2);
111
+ interpolatedFormat[key] = formatMessage(
112
+ value2,
113
+ type === "plural" || type === "selectordinal"
114
+ );
112
115
  }
113
116
  );
114
117
  } else {
package/dist/index.mjs CHANGED
@@ -91,11 +91,11 @@ const selectFormatter = (value, rules) => rules[value] ?? rules.other;
91
91
  function interpolate(translation, locale, locales) {
92
92
  return (values = {}, formats) => {
93
93
  const formatters = getDefaultFormats(locale, locales, formats);
94
- const formatMessage = (tokens) => {
94
+ const formatMessage = (tokens, replaceOctothorpe = false) => {
95
95
  if (!Array.isArray(tokens))
96
96
  return tokens;
97
97
  return tokens.reduce((message, token) => {
98
- if (token === "#") {
98
+ if (token === "#" && replaceOctothorpe) {
99
99
  return message + OCTOTHORPE_PH;
100
100
  }
101
101
  if (isString(token)) {
@@ -106,7 +106,10 @@ function interpolate(translation, locale, locales) {
106
106
  if (type === "plural" || type === "selectordinal" || type === "select") {
107
107
  Object.entries(format).forEach(
108
108
  ([key, value2]) => {
109
- interpolatedFormat[key] = formatMessage(value2);
109
+ interpolatedFormat[key] = formatMessage(
110
+ value2,
111
+ type === "plural" || type === "selectordinal"
112
+ );
110
113
  }
111
114
  );
112
115
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/core",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "sideEffects": false,
5
5
  "description": "I18n tools for javascript",
6
6
  "main": "./dist/index.cjs",
@@ -54,12 +54,12 @@
54
54
  ],
55
55
  "dependencies": {
56
56
  "@babel/runtime": "^7.20.13",
57
- "@lingui/message-utils": "4.10.0",
57
+ "@lingui/message-utils": "4.11.0",
58
58
  "unraw": "^3.0.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@lingui/jest-mocks": "*",
62
62
  "unbuild": "2.0.0"
63
63
  },
64
- "gitHead": "5088feb92de2a669659e85067c2849331122e830"
64
+ "gitHead": "8668ba8ef405d99d496949ff9681247deb97063d"
65
65
  }