@dile/crud 0.6.7 → 0.6.9
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/lib/translationService.js +16 -6
- package/package.json +2 -2
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {TranslationService as OriginalTranslationService} from '@dile/ui/mixins/i18n/TranslationService.js';
|
|
1
|
+
import { TranslationService as OriginalTranslationService } from '@dile/ui/mixins/i18n/TranslationService.js';
|
|
2
2
|
|
|
3
|
-
const translations = import.meta.glob('./i18n/*.js');
|
|
3
|
+
const translations = import.meta.glob('./i18n/*.js', { eager: true });
|
|
4
4
|
|
|
5
5
|
class TranslationService extends OriginalTranslationService {
|
|
6
6
|
async importLanguage(language) {
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const importPath = `./i18n/${language}.js`;
|
|
8
|
+
|
|
9
|
+
if (translations[importPath]) {
|
|
10
|
+
return translations[importPath];
|
|
11
|
+
} else {
|
|
12
|
+
throw new Error(`Translation file for language "${language}" not found.`);
|
|
13
|
+
}
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
async importFallback() {
|
|
12
|
-
const
|
|
13
|
-
|
|
17
|
+
const fallbackPath = './i18n/en.js';
|
|
18
|
+
|
|
19
|
+
if (translations[fallbackPath]) {
|
|
20
|
+
return translations[fallbackPath];
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error('Fallback translation file not found.');
|
|
23
|
+
}
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Components to create a generic crud system based on Web Components and Lit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "4206a26c8acdf404ecc53cacec8f801b4288b63f"
|
|
35
35
|
}
|