fix(editor): Convert autocompleteUIValues to a getter and streamline i18n HMR import (no-changelog) (#19560)

This commit is contained in:
Csaba Tuncsik
2025-09-16 10:55:46 +02:00
committed by GitHub
parent a400716d37
commit 7d988dbf84
7 changed files with 36 additions and 52 deletions

View File

@@ -109,8 +109,6 @@ watch(
},
{ immediate: true },
);
// Dev HMR for i18n is imported in main.ts before app mount
</script>
<template>

View File

@@ -3,7 +3,7 @@ import 'fake-indexeddb/auto';
import { configure } from '@testing-library/vue';
import 'core-js/proposals/set-methods-v2';
import englishBaseText from '@n8n/i18n/locales/en.json';
import { loadLanguage } from '@n8n/i18n';
import { loadLanguage, type LocaleMessages } from '@n8n/i18n';
import { APP_MODALS_ELEMENT_ID } from '@/constants';
// Avoid tests failing because of difference between local and GitHub actions timezone
@@ -147,4 +147,4 @@ Object.defineProperty(HTMLElement.prototype, 'scrollTo', {
value: vi.fn(),
});
loadLanguage('en', englishBaseText);
loadLanguage('en', englishBaseText as LocaleMessages);

View File

@@ -1,7 +0,0 @@
import { loadLanguage } from '@n8n/i18n';
import type { LocaleMessages } from '@n8n/i18n/types';
export async function loadDefaultEn() {
const mod = (await import('@n8n/i18n/locales/en.json')) as { default: LocaleMessages };
loadLanguage('en', mod.default);
}

View File

@@ -11,11 +11,13 @@ import '@n8n/design-system/css/index.scss';
// import '@n8n/design-system/css/tailwind/index.css';
import './n8n-theme.scss';
// Ensure i18n HMR owner is evaluated as early as possible in dev
import '@/dev/i18nHmr';
import App from '@/App.vue';
import router from './router';
import { i18nInstance, setLanguage } from '@n8n/i18n';
import { i18nInstance } from '@n8n/i18n';
import { TelemetryPlugin } from './plugins/telemetry';
import { GlobalComponentsPlugin } from './plugins/components';
@@ -35,17 +37,6 @@ const app = createApp(App);
app.use(SentryPlugin);
// Initialize i18n
if (import.meta.env.DEV) {
// Import HMR owner early so messages are seeded before app mount
await import('@/dev/i18nHmr');
setLanguage('en');
} else {
// Production: load English messages explicitly via isolated module
const { loadDefaultEn } = await import('@/i18n/loadDefaultEn');
await loadDefaultEn();
}
// Register module routes
// We do this here so landing straight on a module page works
registerModuleRoutes(router);