AI-native design editor. Open-source Figma alternative.
chore(i18n): sync all locale files and add CI check
Danila Poyarkov74e550adb25d
diff --git a/package.json b/package.jsonindex 7cda43dec..55bfde8a2 100644--- a/package.json+++ b/package.json@@ -15,7 +15,8 @@"lint": "bun run lint:structure && oxlint -c oxlint.json --type-aware --type-check src/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/","lint:structure": "oxlint -c oxlint.json vite.config.ts vite/ src/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/ tests/ scripts/","format": "oxfmt --write .oxfmtrc.json vite.config.ts vite/ src/ packages/core/src/ packages/cli/src/ packages/mcp/src/ packages/vue/src/ tests scripts/",- "check": "bun run lint && tsgo --noEmit && bun run check:vue",+ "check": "bun run lint && tsgo --noEmit && bun run check:vue && bun run check:i18n",+ "check:i18n": "bun scripts/check-locales.ts","check:vue": "vue-tsc --noEmit -p tsconfig.json && vue-tsc --noEmit -p packages/vue/tsconfig.json","test": "playwright test --project=openpencil","test:update": "playwright test --project=openpencil --update-snapshots",diff --git a/packages/vue/src/locales/de.json b/packages/vue/src/locales/de.jsonindex 030a1ae65..150841e94 100644--- a/packages/vue/src/locales/de.json+++ b/packages/vue/src/locales/de.json@@ -175,7 +175,25 @@"create": "Erstellen","createNumberVariable": "Zahlenvariable aus {value} erstellen","strokeDash": "Gestrichelter Strich",- "add": "Hinzufügen"+ "add": "Hinzufügen",+ "variants": "Varianten",+ "gapAuto": "Automatischer Abstand",+ "horizontalGap": "Horizontaler Abstand",+ "verticalGap": "Vertikaler Abstand",+ "addMinWidth": "Mindestbreite hinzufuegen",+ "removeMinWidth": "Mindestbreite entfernen",+ "addMaxWidth": "Maximalbreite hinzufuegen",+ "removeMaxWidth": "Maximalbreite entfernen",+ "addMinHeight": "Mindesthoehe hinzufuegen",+ "removeMinHeight": "Mindesthoehe entfernen",+ "addMaxHeight": "Maximalhoehe hinzufuegen",+ "removeMaxHeight": "Maximalhoehe entfernen",+ "minWidthShort": "Min B",+ "maxWidthShort": "Max B",+ "minHeightShort": "Min H",+ "maxHeightShort": "Max H",+ "setToCurrentWidth": "Auf aktuelle Breite setzen",+ "setToCurrentHeight": "Auf aktuelle Hoehe setzen"},"pages": {"newPage": "Neue Seite",@@ -225,7 +243,15 @@"updateInstalledTitle": "Update installiert","updateInstalled": "OpenPencil {version} wurde installiert{size}. Neustart jetzt.","updateCheckFailed": "Updates konnten nicht geprüft werden: {error}",- "updateUnavailable": "Updates sind noch nicht verfügbar. Veröffentliche zuerst ein signiertes Release mit latest.json."+ "updateUnavailable": "Updates sind noch nicht verfügbar. Veröffentliche zuerst ein signiertes Release mit latest.json.",+ "renameCollection": "Sammlung umbenennen",+ "deleteCollection": "Sammlung loeschen",+ "modes": "Modi",+ "addMode": "Modus hinzufuegen",+ "renameMode": "Modus umbenennen",+ "duplicateMode": "Modus duplizieren",+ "deleteMode": "Modus loeschen",+ "setDefaultMode": "Als Standard festlegen"},"variableTypes": {"color": "Farbe",diff --git a/packages/vue/src/locales/es.json b/packages/vue/src/locales/es.jsonindex da8fb4835..ae1cd5e8c 100644--- a/packages/vue/src/locales/es.json+++ b/packages/vue/src/locales/es.json@@ -175,7 +175,25 @@"create": "Crear","createNumberVariable": "Crear variable numérica desde {value}","strokeDash": "Trazo discontinuo",- "add": "Añadir"+ "add": "Añadir",+ "variants": "Variantes",+ "gapAuto": "Espaciado auto",+ "horizontalGap": "Espaciado horizontal",+ "verticalGap": "Espaciado vertical",+ "addMinWidth": "Agregar ancho min",+ "removeMinWidth": "Eliminar ancho min",+ "addMaxWidth": "Agregar ancho max",+ "removeMaxWidth": "Eliminar ancho max",+ "addMinHeight": "Agregar alto min",+ "removeMinHeight": "Eliminar alto min",+ "addMaxHeight": "Agregar alto max",+ "removeMaxHeight": "Eliminar alto max",+ "minWidthShort": "Min A",+ "maxWidthShort": "Max A",+ "minHeightShort": "Min Al",+ "maxHeightShort": "Max Al",+ "setToCurrentWidth": "Establecer ancho actual",+ "setToCurrentHeight": "Establecer alto actual"},"pages": {"newPage": "Nueva página",@@ -225,7 +243,15 @@"updateInstalledTitle": "Actualización instalada","updateInstalled": "OpenPencil {version} se instaló{size}. Reiniciando ahora.","updateCheckFailed": "No se pudo buscar actualizaciones: {error}",- "updateUnavailable": "Las actualizaciones aún no están disponibles. Publica primero una versión firmada con latest.json."+ "updateUnavailable": "Las actualizaciones aún no están disponibles. Publica primero una versión firmada con latest.json.",+ "renameCollection": "Renombrar coleccion",+ "deleteCollection": "Eliminar coleccion",+ "modes": "Modos",+ "addMode": "Agregar modo",+ "renameMode": "Renombrar modo",+ "duplicateMode": "Duplicar modo",+ "deleteMode": "Eliminar modo",+ "setDefaultMode": "Establecer como predeterminado"},"variableTypes": {"color": "Color",diff --git a/packages/vue/src/locales/fr.json b/packages/vue/src/locales/fr.jsonindex a480c72b3..e4deb9d38 100644--- a/packages/vue/src/locales/fr.json+++ b/packages/vue/src/locales/fr.json@@ -175,7 +175,25 @@"create": "Créer","createNumberVariable": "Créer une variable numérique depuis {value}","strokeDash": "Trait en pointillés",- "add": "Ajouter"+ "add": "Ajouter",+ "variants": "Variantes",+ "gapAuto": "Espacement auto",+ "horizontalGap": "Espacement horizontal",+ "verticalGap": "Espacement vertical",+ "addMinWidth": "Ajouter largeur min",+ "removeMinWidth": "Supprimer largeur min",+ "addMaxWidth": "Ajouter largeur max",+ "removeMaxWidth": "Supprimer largeur max",+ "addMinHeight": "Ajouter hauteur min",+ "removeMinHeight": "Supprimer hauteur min",+ "addMaxHeight": "Ajouter hauteur max",+ "removeMaxHeight": "Supprimer hauteur max",+ "minWidthShort": "Min L",+ "maxWidthShort": "Max L",+ "minHeightShort": "Min H",+ "maxHeightShort": "Max H",+ "setToCurrentWidth": "Largeur actuelle",+ "setToCurrentHeight": "Hauteur actuelle"},"pages": {"newPage": "Nouvelle page",@@ -225,7 +243,15 @@"updateInstalledTitle": "Mise à jour installée","updateInstalled": "OpenPencil {version} a été installé{size}. Redémarrage maintenant.","updateCheckFailed": "Impossible de rechercher des mises à jour : {error}",- "updateUnavailable": "Les mises à jour ne sont pas encore disponibles. Publiez d’abord une version signée avec latest.json."+ "updateUnavailable": "Les mises à jour ne sont pas encore disponibles. Publiez d’abord une version signée avec latest.json.",+ "renameCollection": "Renommer la collection",+ "deleteCollection": "Supprimer la collection",+ "modes": "Modes",+ "addMode": "Ajouter un mode",+ "renameMode": "Renommer le mode",+ "duplicateMode": "Dupliquer le mode",+ "deleteMode": "Supprimer le mode",+ "setDefaultMode": "Definir par defaut"},"variableTypes": {"color": "Couleur",diff --git a/packages/vue/src/locales/it.json b/packages/vue/src/locales/it.jsonindex 0727c3a22..4fa45bb1e 100644--- a/packages/vue/src/locales/it.json+++ b/packages/vue/src/locales/it.json@@ -175,7 +175,25 @@"create": "Crea","createNumberVariable": "Crea variabile numerica da {value}","strokeDash": "Tratto tratteggiato",- "add": "Aggiungi"+ "add": "Aggiungi",+ "variants": "Varianti",+ "gapAuto": "Spaziatura auto",+ "horizontalGap": "Spaziatura orizzontale",+ "verticalGap": "Spaziatura verticale",+ "addMinWidth": "Aggiungi larghezza min",+ "removeMinWidth": "Rimuovi larghezza min",+ "addMaxWidth": "Aggiungi larghezza max",+ "removeMaxWidth": "Rimuovi larghezza max",+ "addMinHeight": "Aggiungi altezza min",+ "removeMinHeight": "Rimuovi altezza min",+ "addMaxHeight": "Aggiungi altezza max",+ "removeMaxHeight": "Rimuovi altezza max",+ "minWidthShort": "Min L",+ "maxWidthShort": "Max L",+ "minHeightShort": "Min A",+ "maxHeightShort": "Max A",+ "setToCurrentWidth": "Imposta larghezza attuale",+ "setToCurrentHeight": "Imposta altezza attuale"},"pages": {"newPage": "Nuova pagina",@@ -225,7 +243,15 @@"updateInstalledTitle": "Aggiornamento installato","updateInstalled": "OpenPencil {version} è stato installato{size}. Riavvio in corso.","updateCheckFailed": "Impossibile controllare gli aggiornamenti: {error}",- "updateUnavailable": "Gli aggiornamenti non sono ancora disponibili. Pubblica prima una release firmata con latest.json."+ "updateUnavailable": "Gli aggiornamenti non sono ancora disponibili. Pubblica prima una release firmata con latest.json.",+ "renameCollection": "Rinomina raccolta",+ "deleteCollection": "Elimina raccolta",+ "modes": "Modalita",+ "addMode": "Aggiungi modalita",+ "renameMode": "Rinomina modalita",+ "duplicateMode": "Duplica modalita",+ "deleteMode": "Elimina modalita",+ "setDefaultMode": "Imposta come predefinita"},"variableTypes": {"color": "Colore",diff --git a/packages/vue/src/locales/pl.json b/packages/vue/src/locales/pl.jsonindex 6c7b47613..739155ed4 100644--- a/packages/vue/src/locales/pl.json+++ b/packages/vue/src/locales/pl.json@@ -175,7 +175,25 @@"create": "Utwórz","createNumberVariable": "Utwórz zmienną liczbową z {value}","strokeDash": "Obrys przerywany",- "add": "Dodaj"+ "add": "Dodaj",+ "variants": "Warianty",+ "gapAuto": "Automatyczny odstep",+ "horizontalGap": "Odstep poziomy",+ "verticalGap": "Odstep pionowy",+ "addMinWidth": "Dodaj min. szerokosc",+ "removeMinWidth": "Usun min. szerokosc",+ "addMaxWidth": "Dodaj maks. szerokosc",+ "removeMaxWidth": "Usun maks. szerokosc",+ "addMinHeight": "Dodaj min. wysokosc",+ "removeMinHeight": "Usun min. wysokosc",+ "addMaxHeight": "Dodaj maks. wysokosc",+ "removeMaxHeight": "Usun maks. wysokosc",+ "minWidthShort": "Min Sz",+ "maxWidthShort": "Maks Sz",+ "minHeightShort": "Min W",+ "maxHeightShort": "Maks W",+ "setToCurrentWidth": "Ustaw biezaca szerokosc",+ "setToCurrentHeight": "Ustaw biezaca wysokosc"},"pages": {"newPage": "Nowa strona",@@ -225,7 +243,15 @@"updateInstalledTitle": "Aktualizacja zainstalowana","updateInstalled": "OpenPencil {version} został zainstalowany{size}. Ponowne uruchamianie.","updateCheckFailed": "Nie udało się sprawdzić aktualizacji: {error}",- "updateUnavailable": "Aktualizacje nie są jeszcze dostępne. Najpierw opublikuj podpisane wydanie z latest.json."+ "updateUnavailable": "Aktualizacje nie są jeszcze dostępne. Najpierw opublikuj podpisane wydanie z latest.json.",+ "renameCollection": "Zmien nazwe kolekcji",+ "deleteCollection": "Usun kolekcje",+ "modes": "Tryby",+ "addMode": "Dodaj tryb",+ "renameMode": "Zmien nazwe trybu",+ "duplicateMode": "Duplikuj tryb",+ "deleteMode": "Usun tryb",+ "setDefaultMode": "Ustaw jako domyslny"},"variableTypes": {"color": "Kolor",diff --git a/packages/vue/src/locales/ru.json b/packages/vue/src/locales/ru.jsonindex 19d1e8057..27e1db37f 100644--- a/packages/vue/src/locales/ru.json+++ b/packages/vue/src/locales/ru.json@@ -176,7 +176,24 @@"createNumberVariable": "Создать числовую переменную из {value}","strokeDash": "Пунктирная обводка","add": "Добавить",- "variants": "Варианты"+ "variants": "Варианты",+ "gapAuto": "Авто отступ",+ "horizontalGap": "Горизонтальный отступ",+ "verticalGap": "Вертикальный отступ",+ "addMinWidth": "Добавить мин. ширину",+ "removeMinWidth": "Убрать мин. ширину",+ "addMaxWidth": "Добавить макс. ширину",+ "removeMaxWidth": "Убрать макс. ширину",+ "addMinHeight": "Добавить мин. высоту",+ "removeMinHeight": "Убрать мин. высоту",+ "addMaxHeight": "Добавить макс. высоту",+ "removeMaxHeight": "Убрать макс. высоту",+ "minWidthShort": "Мин Ш",+ "maxWidthShort": "Макс Ш",+ "minHeightShort": "Мин В",+ "maxHeightShort": "Макс В",+ "setToCurrentWidth": "Установить текущую ширину",+ "setToCurrentHeight": "Установить текущую высоту"},"pages": {"newPage": "Новая страница",diff --git a/packages/vue/src/locales/zh-CN.json b/packages/vue/src/locales/zh-CN.jsonindex d2149904c..879cadf3f 100644--- a/packages/vue/src/locales/zh-CN.json+++ b/packages/vue/src/locales/zh-CN.json@@ -176,7 +176,24 @@"createNumberVariable": "从 {value} 创建数字变量","strokeDash": "虚线描边","add": "添加",- "variants": "变体"+ "variants": "变体",+ "gapAuto": "自动间距",+ "horizontalGap": "水平间距",+ "verticalGap": "垂直间距",+ "addMinWidth": "添加最小宽度",+ "removeMinWidth": "移除最小宽度",+ "addMaxWidth": "添加最大宽度",+ "removeMaxWidth": "移除最大宽度",+ "addMinHeight": "添加最小高度",+ "removeMinHeight": "移除最小高度",+ "addMaxHeight": "添加最大高度",+ "removeMaxHeight": "移除最大高度",+ "minWidthShort": "最小宽",+ "maxWidthShort": "最大宽",+ "minHeightShort": "最小高",+ "maxHeightShort": "最大高",+ "setToCurrentWidth": "设为当前宽度",+ "setToCurrentHeight": "设为当前高度"},"pages": {"newPage": "新建页面",diff --git a/scripts/check-locales.ts b/scripts/check-locales.tsnew file mode 100644index 000000000..1fb21cb7f--- /dev/null+++ b/scripts/check-locales.ts@@ -0,0 +1,48 @@+#!/usr/bin/env bun+import { readFileSync, readdirSync } from 'node:fs'+import { join } from 'node:path'++const MESSAGES_PATH = 'packages/vue/src/i18n/messages.ts'+const LOCALES_DIR = 'packages/vue/src/locales'++const content = readFileSync(MESSAGES_PATH, 'utf-8')++const blocks = [...content.matchAll(/i18n\('(\w+)',\s*\{([\s\S]*?)\n\}\)/g)]+const enKeys = new Map<string, Set<string>>()+for (const [, ns, body] of blocks) {+ const keys = [...body.matchAll(/^\s+(\w+):/gm)].map((m) => m[1])+ enKeys.set(ns, new Set(keys))+}++const localeFiles = readdirSync(LOCALES_DIR).filter((f) => f.endsWith('.json'))+let hasErrors = false++for (const file of localeFiles) {+ const data = JSON.parse(readFileSync(join(LOCALES_DIR, file), 'utf-8'))+ const missing: string[] = []+ const extra: string[] = []++ for (const [ns, keys] of enKeys) {+ const localeNs = (data[ns] ?? {}) as Record<string, unknown>+ for (const key of keys) {+ if (!(key in localeNs)) missing.push(`${ns}.${key}`)+ }+ for (const key of Object.keys(localeNs)) {+ if (!keys.has(key)) extra.push(`${ns}.${key}`)+ }+ }++ if (missing.length > 0 || extra.length > 0) {+ hasErrors = true+ console.error(`\n${file}:`)+ for (const m of missing) console.error(` missing: ${m}`)+ for (const e of extra) console.error(` extra: ${e}`)+ }+}++if (hasErrors) {+ console.error('\nLocale files are out of sync with messages.ts')+ process.exit(1)+} else {+ console.log('All locale files are in sync.')+}