refactor: cleanup translations

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-07 17:57:43 -04:00
parent d92a0331a6
commit 5a729d851e
8 changed files with 43 additions and 31 deletions
+3 -3
View File
@@ -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' } },