@dile/crud 0.3.0 → 0.3.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/lib/DileI18nMixin.js +13 -26
- package/lib/translationService.js +9 -21
- package/package.json +3 -3
package/lib/DileI18nMixin.js
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export const DileI18nMixin = (superclass) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
translations
|
|
1
|
+
import { DileI18nMixin as OriginalDileI18nMixin } from '@dile/ui/mixins/i18n/DileI18nMixin.js';
|
|
2
|
+
import { translationService } from './translationService';
|
|
3
|
+
export const DileI18nMixin = (superclass) =>
|
|
4
|
+
class extends OriginalDileI18nMixin(translationService)(superclass) {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.translations = {
|
|
8
|
+
success_operation: () => '',
|
|
9
|
+
error_operation: () => '',
|
|
10
|
+
showing_page_size: () => '',
|
|
11
|
+
current_page: () => '',
|
|
12
|
+
};
|
|
8
13
|
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
this.language = 'en';
|
|
14
|
-
this.translations = {
|
|
15
|
-
success_operation: () => '',
|
|
16
|
-
error_operation: () => '',
|
|
17
|
-
showing_page_size: () => '',
|
|
18
|
-
current_page: () => '',
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async connectedCallback() {
|
|
23
|
-
super.connectedCallback();
|
|
24
|
-
this.translations = await translationService.loadTranslations(this.language);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
14
|
+
};
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
constructor() {
|
|
3
|
-
this.translations = {};
|
|
4
|
-
}
|
|
1
|
+
import {TranslationService as OriginalTranslationService} from '@dile/ui/mixins/i18n/TranslationService.js';
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.warn(`Could not load translations for language: ${language}, falling back to English`);
|
|
14
|
-
|
|
15
|
-
if (!this.translations['en']) {
|
|
16
|
-
const defaultModule = await import('./i18n/en.js');
|
|
17
|
-
this.translations['en'] = defaultModule.translations;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return this.translations['en'];
|
|
21
|
-
}
|
|
3
|
+
class TranslationService extends OriginalTranslationService {
|
|
4
|
+
async importLanguage(language) {
|
|
5
|
+
const module = await import(`./i18n/${language}.js`);
|
|
6
|
+
return module;
|
|
7
|
+
}
|
|
22
8
|
|
|
23
|
-
|
|
9
|
+
async importFallback() {
|
|
10
|
+
const defaultModule = await import('./i18n/en.js');
|
|
11
|
+
return defaultModule;
|
|
24
12
|
}
|
|
25
13
|
}
|
|
26
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Components to create a generic crud system based on Web Components and Lit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://dile-components.polydile.com/",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@dile/ui": "^2.3.
|
|
27
|
+
"@dile/ui": "^2.3.1",
|
|
28
28
|
"axios": "^1.7.2",
|
|
29
29
|
"lit": "^2.7.0 || ^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "80e68858b65ac111ffba6ed72eee05df0a0aeb94"
|
|
35
35
|
}
|