@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.
@@ -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 module = await import(`./i18n/${language}.js`);
8
- return module;
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 defaultModule = await import('./i18n/en.js');
13
- return defaultModule;
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.7",
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": "cf760dbcc0ec2b0037587987a26d01a3b8a42bdf"
34
+ "gitHead": "4206a26c8acdf404ecc53cacec8f801b4288b63f"
35
35
  }