@dile/editor
Advanced tools
Comparing version 2.4.8 to 2.4.9
{ | ||
"name": "@dile/editor", | ||
"version": "2.4.8", | ||
"version": "2.4.9", | ||
"description": "Webcomponent to create a user editor interface, configured on various ways", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "8665bccc5f2c06da590d20a3bfd2f7b4c0a7638c" | ||
"gitHead": "f833a589b4bf56c3a1b46e40d3c5ce364b0facca" | ||
} |
@@ -1,15 +0,27 @@ | ||
import {TranslationService as OriginalTranslationService} from '@dile/ui/mixins/i18n/TranslationService.js'; | ||
import { TranslationService as OriginalTranslationService } from '@dile/ui/mixins/i18n/TranslationService.js'; | ||
const translations = import.meta.glob('./i18n/*.js', { eager: true }); | ||
class TranslationService extends OriginalTranslationService { | ||
async importLanguage(language) { | ||
const module = await import(`./i18n/${language}.js`); | ||
return module; | ||
const importPath = `./i18n/${language}.js`; | ||
if (translations[importPath]) { | ||
return translations[importPath]; | ||
} else { | ||
throw new Error(`Translation file for language "${language}" not found.`); | ||
} | ||
} | ||
async importFallback() { | ||
const defaultModule = await import('./i18n/en.js'); | ||
return defaultModule; | ||
const fallbackPath = './i18n/en.js'; | ||
if (translations[fallbackPath]) { | ||
return translations[fallbackPath]; | ||
} else { | ||
throw new Error('Fallback translation file not found.'); | ||
} | ||
} | ||
} | ||
export const translationService = new TranslationService(); | ||
export const translationService = new TranslationService(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33865
1043