i18n-keyless-core 2.6.0 → 2.6.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-core",
3
3
  "private": false,
4
- "version": "2.6.0",
4
+ "version": "2.6.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
package/dist/service.js CHANGED
@@ -84,8 +84,10 @@ export function getTranslationCore(key, store, options) {
84
84
  .map((key) => key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
85
85
  .join("|");
86
86
  const regex = new RegExp(pattern, "g");
87
- // Replace all occurrences in a single pass
88
- return translation.replace(regex, (matched) => options.replace?.[matched] || matched);
87
+ // Replace all occurrences in a single pass. `translation` can be undefined
88
+ // when the current language's translation hasn't arrived yet (translateKey
89
+ // was just queued above) — fall back to the key like the no-replace path.
90
+ return (translation || key).replace(regex, (matched) => options.replace?.[matched] || matched);
89
91
  }
90
92
  const translating = {};
91
93
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-core",
3
3
  "private": false,
4
- "version": "2.6.0",
4
+ "version": "2.6.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",