Compare commits

...

2 Commits

Author SHA1 Message Date
snomiao
b1e593086f fix: add error handling to prevent locale load failure from bricking startup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 22:41:14 +09:00
snomiao
4e886be234 fix: load initial locale before mounting desktop-ui app
On startup, i18n was initialized with the correct locale code (from
navigator.language) but only English messages were bundled. The
translations for non-English locales were never loaded, causing the UI
to render in English even when the language switcher correctly showed
e.g. "日本語".

Manual switching worked because LanguageSelector calls loadLocale()
explicitly. This fix applies the same logic at startup by awaiting
loadLocale() before mounting — a no-op for English users since 'en' is
pre-seeded in loadedLocales.

Fixes: desktop-ui i18n not applied on first render
2026-03-18 18:07:05 +09:00

View File

@@ -10,7 +10,7 @@ import { createApp } from 'vue'
import App from './App.vue'
import './assets/css/style.css'
import { i18n } from './i18n'
import { i18n, loadLocale } from './i18n'
import router from './router'
const ComfyUIPreset = definePreset(Aura, {
@@ -20,6 +20,11 @@ const ComfyUIPreset = definePreset(Aura, {
}
})
// Load the initial locale before mounting to avoid rendering with missing translations.
// Errors are caught to prevent a failed locale fetch from bricking startup; the app
// falls back to English in that case.
await loadLocale(i18n.global.locale.value).catch(() => {})
const app = createApp(App)
const pinia = createPinia()