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 +1 -1
- package/dist/service.js +4 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +2 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
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
|
-
|
|
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