@dile/editor 2.4.11 → 2.4.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/editor",
3
- "version": "2.4.11",
3
+ "version": "2.4.13",
4
4
  "description": "Webcomponent to create a user editor interface, configured on various ways",
5
5
  "keywords": [
6
6
  "markdown",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@dile/icons": "^2.1.1",
33
- "@dile/ui": "^2.5.1",
33
+ "@dile/ui": "^2.5.2",
34
34
  "lit": "^2.7.0 || ^3.0.0",
35
35
  "prosemirror-commands": "^1.6.2",
36
36
  "prosemirror-example-setup": "^1.2.3",
@@ -41,5 +41,5 @@
41
41
  "prosemirror-state": "^1.4.3",
42
42
  "prosemirror-view": "^1.37.0"
43
43
  },
44
- "gitHead": "d47c95ca824b187c3ec50f3470a5c2162158d862"
44
+ "gitHead": "835b290fb9a8796a94961f2dfe779b4e61446bb8"
45
45
  }
@@ -1,27 +1,26 @@
1
1
  import { TranslationService as OriginalTranslationService } from '@dile/ui/mixins/i18n/TranslationService.js';
2
2
 
3
- const translations = import.meta.glob('./i18n/*.js', { eager: true });
4
-
5
3
  class TranslationService extends OriginalTranslationService {
6
- async importLanguage(language) {
7
- const importPath = `./i18n/${language}.js`;
8
4
 
9
- if (translations[importPath]) {
10
- return translations[importPath];
11
- } else {
12
- throw new Error(`Translation file for language "${language}" not found.`);
5
+ async importLanguage(language) {
6
+ switch (language) {
7
+ case 'es':
8
+ return import('./i18n/es.js');
9
+ case 'en':
10
+ return import('./i18n/en.js');
11
+ default:
12
+ throw new Error(`Unsupported language: ${language}`);
13
13
  }
14
14
  }
15
15
 
16
16
  async importFallback() {
17
- const fallbackPath = './i18n/en.js';
18
-
19
- if (translations[fallbackPath]) {
20
- return translations[fallbackPath];
21
- } else {
17
+ try {
18
+ return import('./i18n/en.js');
19
+ } catch (error) {
22
20
  throw new Error('Fallback translation file not found.');
23
21
  }
24
22
  }
23
+
25
24
  }
26
25
 
27
26
  export const translationService = new TranslationService();