diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts index 719b0e5f..619e3268 100644 --- a/frontend/src/i18n/index.ts +++ b/frontend/src/i18n/index.ts @@ -30,6 +30,38 @@ import enSeo3 from "./locales/en/seo3.json"; import enSeo4 from "./locales/en/seo4.json"; import { DEFAULT_LOCALE, LOCALES, type Locale } from "./config"; +/** + * Deep merge for locale resource files. The namespace used to be built + * with a SHALLOW spread, so a top-level section present in two files had + * the later file silently clobber the earlier one wholesale: common2's + * `editor` erased common.json's `editor.share.*` (the Share modal's + * visibility labels rendered as raw keys), and the same collision on + * `header` later wiped `header.auth.*` — the account menu showed + * "header.auth.signOut". Merging by key ends the failure class. + */ +function deepMerge( + base: Record, + extra: Record, +): Record { + const out: Record = { ...base }; + for (const [k, v] of Object.entries(extra)) { + const prev = out[k]; + if ( + prev && v && + typeof prev === "object" && typeof v === "object" && + !Array.isArray(prev) && !Array.isArray(v) + ) { + out[k] = deepMerge( + prev as Record, + v as Record, + ); + } else { + out[k] = v; + } + } + return out; +} + const NAMESPACES = ["common"] as const; type Namespace = (typeof NAMESPACES)[number]; @@ -47,9 +79,7 @@ void i18n resources: { en: { common: { - ...enCommon, - ...enCommon2, - ...enReleases, + ...deepMerge(deepMerge(enCommon, enCommon2), enReleases), seo: { ...enSeo.seo, ...enSeo2.seo, @@ -131,9 +161,10 @@ export async function loadLocale(locale: Locale): Promise { ...((seo4Mod.default ?? seo4Mod).seo ?? {}), }; const merged = { - ...(commonMod.default ?? commonMod), - ...(common2Mod.default ?? common2Mod), - ...(releasesMod.default ?? releasesMod), + ...deepMerge( + deepMerge(commonMod.default ?? commonMod, common2Mod.default ?? common2Mod), + releasesMod.default ?? releasesMod, + ), seo: seoBody, docs: { ...docs1Body, ...docs2Body }, }; diff --git a/frontend/src/i18n/locales/de/common.json b/frontend/src/i18n/locales/de/common.json index 88e4aa86..a1d84208 100644 --- a/frontend/src/i18n/locales/de/common.json +++ b/frontend/src/i18n/locales/de/common.json @@ -23,7 +23,8 @@ "signOut": "Abmelden" }, "language": "Sprache", - "search": "Suche" + "search": "Suche", + "shareProject": "Projekt teilen" }, "footer": { "about": "Velxio ist ein kostenloser, quelloffener Schaltkreis- und Mikrocontroller-Simulator, der vollständig in Ihrem Browser läuft. Arduino, ESP32, RP2040 und ATtiny85, mit SPICE-genauer analoger Co-Simulation. Entwickelt für Maker, Studenten und Embedded-Ingenieure, die durch praktisches Lernen lernen. AGPLv3." diff --git a/frontend/src/i18n/locales/de/common2.json b/frontend/src/i18n/locales/de/common2.json index 8560cb9e..88f9f771 100644 --- a/frontend/src/i18n/locales/de/common2.json +++ b/frontend/src/i18n/locales/de/common2.json @@ -463,8 +463,5 @@ "subtitle": "Keine Anmeldung erforderlich. Läuft zu 100 % in Ihrem Browser. Kostenlos und Open Source.", "openEditor": "Editor öffnen" } - }, - "header": { - "shareProject": "Projekt teilen" } } diff --git a/frontend/src/i18n/locales/en/common.json b/frontend/src/i18n/locales/en/common.json index 2740317f..70dad49f 100644 --- a/frontend/src/i18n/locales/en/common.json +++ b/frontend/src/i18n/locales/en/common.json @@ -23,7 +23,8 @@ "signOut": "Sign out" }, "language": "Language", - "search": "Search" + "search": "Search", + "shareProject": "Share project" }, "footer": { "about": "Velxio is a free, open-source circuit and microcontroller simulator that runs entirely in your browser. Arduino, ESP32, RP2040 and ATtiny85, with SPICE-accurate analog co-simulation. Built for makers, students and embedded engineers learning by doing. AGPLv3." diff --git a/frontend/src/i18n/locales/en/common2.json b/frontend/src/i18n/locales/en/common2.json index c90d4651..13d795c5 100644 --- a/frontend/src/i18n/locales/en/common2.json +++ b/frontend/src/i18n/locales/en/common2.json @@ -465,8 +465,5 @@ "subtitle": "No signup required. Runs 100% in your browser. Free and open source.", "openEditor": "Open Editor" } - }, - "header": { - "shareProject": "Share project" } } diff --git a/frontend/src/i18n/locales/es/common.json b/frontend/src/i18n/locales/es/common.json index 5e083391..bb549e4b 100644 --- a/frontend/src/i18n/locales/es/common.json +++ b/frontend/src/i18n/locales/es/common.json @@ -23,7 +23,8 @@ "signOut": "Cerrar sesión" }, "language": "Idioma", - "search": "Buscar" + "search": "Buscar", + "shareProject": "Compartir proyecto" }, "footer": { "about": "Velxio es un simulador gratuito y de código abierto de circuitos y microcontroladores que funciona completamente en tu navegador. Arduino, ESP32, RP2040 y ATtiny85, con co-simulación analógica precisa con SPICE. Creado para makers, estudiantes e ingenieros de sistemas embebidos que aprenden haciendo. AGPLv3." diff --git a/frontend/src/i18n/locales/es/common2.json b/frontend/src/i18n/locales/es/common2.json index a8f1f457..3c2b48d7 100644 --- a/frontend/src/i18n/locales/es/common2.json +++ b/frontend/src/i18n/locales/es/common2.json @@ -465,8 +465,5 @@ "subtitle": "No requiere registro. Funciona 100% en tu navegador. Gratuito y de código abierto.", "openEditor": "Abrir editor" } - }, - "header": { - "shareProject": "Compartir proyecto" } } diff --git a/frontend/src/i18n/locales/fr/common.json b/frontend/src/i18n/locales/fr/common.json index 3f00595f..4d6ea222 100644 --- a/frontend/src/i18n/locales/fr/common.json +++ b/frontend/src/i18n/locales/fr/common.json @@ -23,7 +23,8 @@ "signOut": "Déconnexion" }, "language": "Langue", - "search": "Rechercher" + "search": "Rechercher", + "shareProject": "Partager le projet" }, "footer": { "about": "Velxio est un simulateur de circuits et microcontrôleurs gratuit et open-source qui fonctionne entièrement dans votre navigateur. Arduino, ESP32, RP2040 et ATtiny85, avec co-simulation analogique précise SPICE. Conçu pour les makers, étudiants et ingénieurs embarqués qui apprennent en pratiquant. AGPLv3." diff --git a/frontend/src/i18n/locales/fr/common2.json b/frontend/src/i18n/locales/fr/common2.json index 46544a18..93a266e9 100644 --- a/frontend/src/i18n/locales/fr/common2.json +++ b/frontend/src/i18n/locales/fr/common2.json @@ -463,8 +463,5 @@ "subtitle": "Aucune inscription requise. Fonctionne à 100 % dans votre navigateur. Gratuit et open source.", "openEditor": "Ouvrir l'éditeur" } - }, - "header": { - "shareProject": "Partager le projet" } } diff --git a/frontend/src/i18n/locales/it/common.json b/frontend/src/i18n/locales/it/common.json index 4b37eb40..85519adf 100644 --- a/frontend/src/i18n/locales/it/common.json +++ b/frontend/src/i18n/locales/it/common.json @@ -23,7 +23,8 @@ "signOut": "Esci" }, "language": "Lingua", - "search": "Cerca" + "search": "Cerca", + "shareProject": "Condividi progetto" }, "footer": { "about": "Velxio è un simulatore gratuito e open-source di circuiti e microcontrollori che funziona interamente nel tuo browser. Arduino, ESP32, RP2040 e ATtiny85, con co-simulazione analogica SPICE accurata. Creato per maker, studenti e ingegneri embedded che imparano facendo. AGPLv3." diff --git a/frontend/src/i18n/locales/it/common2.json b/frontend/src/i18n/locales/it/common2.json index f4a4e1f3..f6fe7465 100644 --- a/frontend/src/i18n/locales/it/common2.json +++ b/frontend/src/i18n/locales/it/common2.json @@ -463,8 +463,5 @@ "subtitle": "Nessuna registrazione richiesta. Funziona al 100% nel tuo browser. Gratuito e open source.", "openEditor": "Apri Editor" } - }, - "header": { - "shareProject": "Condividi progetto" } } diff --git a/frontend/src/i18n/locales/ja/common.json b/frontend/src/i18n/locales/ja/common.json index 6a513e48..9fb40312 100644 --- a/frontend/src/i18n/locales/ja/common.json +++ b/frontend/src/i18n/locales/ja/common.json @@ -23,7 +23,8 @@ "signOut": "サインアウト" }, "language": "言語", - "search": "検索" + "search": "検索", + "shareProject": "プロジェクトを共有" }, "footer": { "about": "Velxioは、ブラウザ上で完全に動作する無料のオープンソース回路・マイクロコントローラシミュレータです。Arduino、ESP32、RP2040、ATtiny85に対応し、SPICE精度のアナログ同時シミュレーションを提供します。メーカー、学生、組み込みエンジニアが実践的に学ぶために作られました。AGPLv3ライセンス。" diff --git a/frontend/src/i18n/locales/ja/common2.json b/frontend/src/i18n/locales/ja/common2.json index 3e74c4f8..d3e0b4e3 100644 --- a/frontend/src/i18n/locales/ja/common2.json +++ b/frontend/src/i18n/locales/ja/common2.json @@ -463,8 +463,5 @@ "subtitle": "サインアップ不要。100% ブラウザで動作。無料でオープンソース。", "openEditor": "エディタを開く" } - }, - "header": { - "shareProject": "プロジェクトを共有" } } diff --git a/frontend/src/i18n/locales/pt-br/common.json b/frontend/src/i18n/locales/pt-br/common.json index 5058379d..95e00793 100644 --- a/frontend/src/i18n/locales/pt-br/common.json +++ b/frontend/src/i18n/locales/pt-br/common.json @@ -23,7 +23,8 @@ "signOut": "Sair" }, "language": "Idioma", - "search": "Pesquisar" + "search": "Pesquisar", + "shareProject": "Compartilhar projeto" }, "footer": { "about": "Velxio é um simulador gratuito e de código aberto de circuitos e microcontroladores que roda inteiramente no seu navegador. Arduino, ESP32, RP2040 e ATtiny85, com co-simulação analógica precisa em SPICE. Construído para makers, estudantes e engenheiros embarcados que aprendem na prática. AGPLv3." diff --git a/frontend/src/i18n/locales/pt-br/common2.json b/frontend/src/i18n/locales/pt-br/common2.json index 27680cd6..fab7d433 100644 --- a/frontend/src/i18n/locales/pt-br/common2.json +++ b/frontend/src/i18n/locales/pt-br/common2.json @@ -463,8 +463,5 @@ "subtitle": "Sem necessidade de cadastro. Roda 100% no seu navegador. Gratuito e de código aberto.", "openEditor": "Abrir Editor" } - }, - "header": { - "shareProject": "Compartilhar projeto" } } diff --git a/frontend/src/i18n/locales/ru/common.json b/frontend/src/i18n/locales/ru/common.json index 94777c6b..797917ff 100644 --- a/frontend/src/i18n/locales/ru/common.json +++ b/frontend/src/i18n/locales/ru/common.json @@ -23,7 +23,8 @@ "signOut": "Выйти" }, "language": "Язык", - "search": "Поиск" + "search": "Поиск", + "shareProject": "Поделиться проектом" }, "footer": { "about": "Velxio — это бесплатный симулятор цепей и микроконтроллеров с открытым исходным кодом, работающий прямо в браузере. Arduino, ESP32, RP2040 и ATtiny85 с аналоговым ко-симулятором на SPICE. Создан для любителей, студентов и инженеров, изучающих встраиваемые системы на практике. AGPLv3." diff --git a/frontend/src/i18n/locales/ru/common2.json b/frontend/src/i18n/locales/ru/common2.json index 6c4c1310..f38116d2 100644 --- a/frontend/src/i18n/locales/ru/common2.json +++ b/frontend/src/i18n/locales/ru/common2.json @@ -463,8 +463,5 @@ "subtitle": "Регистрация не требуется. Работает 100% в вашем браузере. Бесплатно и с открытым исходным кодом.", "openEditor": "Открыть редактор" } - }, - "header": { - "shareProject": "Поделиться проектом" } } diff --git a/frontend/src/i18n/locales/zh-cn/common.json b/frontend/src/i18n/locales/zh-cn/common.json index d63db6f6..54336df7 100644 --- a/frontend/src/i18n/locales/zh-cn/common.json +++ b/frontend/src/i18n/locales/zh-cn/common.json @@ -23,7 +23,8 @@ "signOut": "退出" }, "language": "语言", - "search": "搜索" + "search": "搜索", + "shareProject": "分享项目" }, "footer": { "about": "Velxio 是一款免费、开源的电路和微控制器模拟器,完全在浏览器中运行。支持 Arduino、ESP32、RP2040 和 ATtiny85,并具有 SPICE 精度的模拟协同仿真。专为通过实践学习的设计者、学生和嵌入式工程师打造。采用 AGPLv3 许可。" diff --git a/frontend/src/i18n/locales/zh-cn/common2.json b/frontend/src/i18n/locales/zh-cn/common2.json index 7b3b0675..3eb65f44 100644 --- a/frontend/src/i18n/locales/zh-cn/common2.json +++ b/frontend/src/i18n/locales/zh-cn/common2.json @@ -463,8 +463,5 @@ "subtitle": "无需注册。100% 在浏览器中运行。免费且开源。", "openEditor": "打开编辑器" } - }, - "header": { - "shareProject": "分享项目" } }