i18n-keyless-core 2.5.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.5.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/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type PrimaryLang = "fr" | "en";
2
- export declare const AVAILABLE_LANGS: readonly ["fr", "en", "nl", "it", "de", "es", "pl", "pt", "ro", "hu", "sv", "tr", "ja", "cn", "cz", "ru", "ko", "ar"];
2
+ export declare const AVAILABLE_LANGS: readonly ["fr", "en", "nl", "it", "de", "es", "pl", "pt", "ro", "hu", "sv", "tr", "ja", "cn", "cz", "ru", "ko", "ar", "el"];
3
3
  export type Lang = (typeof AVAILABLE_LANGS)[number];
4
4
  /**
5
5
  * The namespace used when none is provided (per call or via `defaultNamespace` in config).
@@ -42,7 +42,7 @@ export type LanguagesConfig = {
42
42
  /**
43
43
  * the languages supported for the user.
44
44
  * For now we support:
45
- * fr, nl, it, de, es, pl, pt, ro, hu, sv, tr, ja, cn, cz, ru, ko, ar
45
+ * fr, nl, it, de, es, pl, pt, ro, hu, sv, tr, ja, cn, cz, ru, ko, ar, el
46
46
  *
47
47
  * If you need more, please reach out to @ambroselli_io on X/Twitter or by mail at arnaud.ambroselli.io@gmail.com
48
48
  */
package/dist/types.js CHANGED
@@ -16,7 +16,8 @@ export const AVAILABLE_LANGS = [
16
16
  "cz",
17
17
  "ru",
18
18
  "ko",
19
- "ar"
19
+ "ar",
20
+ "el"
20
21
  ];
21
22
  /**
22
23
  * The namespace used when none is provided (per call or via `defaultNamespace` in config).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-core",
3
3
  "private": false,
4
- "version": "2.5.0",
4
+ "version": "2.6.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",