@r2digisolutions/ui 0.5.1 → 0.6.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.
|
@@ -10,8 +10,8 @@ export class StoreI18n {
|
|
|
10
10
|
this.#translations;
|
|
11
11
|
return (key, params = {}) => {
|
|
12
12
|
const translations = this.#translations[this.#language];
|
|
13
|
-
const translation = translations
|
|
14
|
-
if (!translation) {
|
|
13
|
+
const translation = this.#getTranslationValue(translations, key);
|
|
14
|
+
if (!translation || typeof translation !== "string") {
|
|
15
15
|
return `--${key}--`;
|
|
16
16
|
}
|
|
17
17
|
return Object.entries(params).reduce((acc, [key, value]) => {
|
|
@@ -23,6 +23,13 @@ export class StoreI18n {
|
|
|
23
23
|
this.#language = language;
|
|
24
24
|
this.#translations = translations;
|
|
25
25
|
}
|
|
26
|
+
#getTranslationValue(translations, key) {
|
|
27
|
+
// Intentar primero como clave plana
|
|
28
|
+
if (translations[key])
|
|
29
|
+
return translations[key];
|
|
30
|
+
// Si no existe como clave plana, intentar lookup recursivo
|
|
31
|
+
return key.split('.').reduce((acc, part) => acc?.[part], translations);
|
|
32
|
+
}
|
|
26
33
|
get language() {
|
|
27
34
|
return this.#language;
|
|
28
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r2digisolutions/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"packageManager": "bun@1.2.8",
|
|
6
6
|
"publishConfig": {
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"eslint-plugin-svelte": "^3.8.0",
|
|
71
71
|
"globals": "^16.1.0",
|
|
72
72
|
"jsdom": "^26.1.0",
|
|
73
|
+
"lucide-svelte": "^0.511.0",
|
|
73
74
|
"prettier": "^3.5.3",
|
|
74
75
|
"prettier-plugin-svelte": "^3.4.0",
|
|
75
76
|
"prettier-plugin-tailwindcss": "^0.6.11",
|