refactor: cleanup translations
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { router } from '@KTXC/router';
|
||||
import { useModuleStore } from '@KTXC/stores/moduleStore';
|
||||
import { useIntegrationStore } from '@KTXC/stores/integrationStore';
|
||||
import { useL10nStore } from '@KTXC/stores/l10nStore';
|
||||
import type { CatalogMessages } from '@KTXC/stores/l10nStore';
|
||||
import type { TranslationCatalog } from '@KTXC/stores/l10nStore';
|
||||
|
||||
function installModuleCSS(moduleHandle: string, cssPaths: string | string[]): void {
|
||||
const cssFiles = Array.isArray(cssPaths) ? cssPaths : [cssPaths];
|
||||
@@ -53,10 +53,10 @@ function installModuleIntegrations(moduleHandle: string, integrations: Record<st
|
||||
}
|
||||
|
||||
async function installModuleLocalizations(moduleHandle: string): Promise<void> {
|
||||
await useL10nStore().registerCatalogProvider(moduleHandle, (locale) => loadModuleLocalizations(moduleHandle, locale));
|
||||
await useL10nStore().registerLoader(moduleHandle, (locale) => loadModuleLocalizations(moduleHandle, locale));
|
||||
}
|
||||
|
||||
async function loadModuleLocalizations(moduleHandle: string, locale: string): Promise<CatalogMessages | null> {
|
||||
async function loadModuleLocalizations(moduleHandle: string, locale: string): Promise<TranslationCatalog | null> {
|
||||
const response = await fetch(
|
||||
`/modules/${moduleHandle}/static/l10n/${locale}.json`,
|
||||
{ headers: { Accept: 'application/json' } },
|
||||
|
||||
Reference in New Issue
Block a user