Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 57 additions & 5 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,49 @@ const settings = {
})
],
'vue-i18n': {
// The rule checks that a path exists, not that it reaches a string, so
// t('g') is accepted. packages/** is left out because a shared package is
// consumed against all three catalogs, so there is no single one to pin.
//
// ESLint's --cache keys on file content and config, never on catalog
// content, so removing a key without touching its call sites can survive a
// cache hit.
localeDir: [
{ pattern: './src/locales/en/main.json', localeKey: 'path' },
{
pattern: './src/locales/**/*.json',
localeKey: 'path',
localePattern:
/^\.?\/?src\/locales\/(?<locale>[A-Za-z0-9-]+)\/.+\.json$/
pattern: './scripts/i18n/eslint-generated-messages.js',
localeKey: 'key'
}
],
// localeDir is relative to ESLint's cwd, so a workspace-local lint run
// would resolve it to nothing and silently report no missing keys.
cwd: import.meta.dirname,
messageSyntaxVersion: '^9.0.0'
}
} as const

const billingWebI18nSettings = {
'vue-i18n': {
localeDir: [
{
pattern: './apps/billing-web/src/locales/en/main.json',
localeKey: 'path'
}
Comment thread
christian-byrne marked this conversation as resolved.
Resolved
],
cwd: import.meta.dirname,
messageSyntaxVersion: '^9.0.0'
}
} as const

const websiteI18nSettings = {
'vue-i18n': {
localeDir: [
{
pattern: './apps/website/src/locales/en/main.json',
localeKey: 'path'
}
Comment thread
christian-byrne marked this conversation as resolved.
Resolved
],
cwd: import.meta.dirname,
messageSyntaxVersion: '^9.0.0'
}
} as const
Expand Down Expand Up @@ -430,5 +465,22 @@ export default defineConfig([
}
}
]
}
},
// Every tree checked against its own catalog. These entries add only the
// catalog and the rule, so the extensions must be ones the blocks above
// already parse: tailwindScriptFiles for .ts, templateFiles for .vue and
// .astro. Adding .mts here would lint it with espree and fail on syntax.
...(
[
['src', settings],
['apps/billing-web', billingWebI18nSettings],
['apps/website', websiteI18nSettings]
] as const
).map(([root, treeSettings]) => ({
files: [`${root}/**/*.{ts,vue,astro}`],
ignores: tailwindScriptIgnores,
settings: treeSettings,
plugins: { '@intlify/vue-i18n': i18nPlugin },
rules: { '@intlify/vue-i18n/no-missing-keys': 'error' as const }
}))
])
13 changes: 13 additions & 0 deletions scripts/i18n/eslint-generated-messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// The generated half of the lint catalog for no-missing-keys, shaped the way
// buildLocale() in src/i18n.ts nests it. main.json stays a plain JSON entry in
// localeDir so editing it refreshes live; the plugin caches this module by its
// own mtime, which never changes when the JSON it imports does, so regenerating
// with `pnpm collect-i18n` needs an ESLint server restart to take effect.
//
// Must stay .js: the plugin's localeDir loader only handles .js, .json and
// .yaml, and renaming this crashes ESLint instead of erroring.
import commands from '../../src/locales/en/commands.json' with { type: 'json' }
import nodeDefs from '../../src/locales/en/nodeDefs.json' with { type: 'json' }
import settings from '../../src/locales/en/settings.json' with { type: 'json' }

export const en = { commands, nodeDefs, settings }
10 changes: 7 additions & 3 deletions src/composables/useCoreCommands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,14 @@ describe('useCoreCommands', () => {
Record<string, string>
>
const original = messages[menuLabels][key]
i18n.global.mergeLocaleMessage('en', {
[menuLabels]: { [key]: 'Sentinel paste label' }
})
const previousLocale = i18n.global.locale.value

try {
i18n.global.locale.value = 'en'
i18n.global.mergeLocaleMessage('en', {
[menuLabels]: { [key]: 'Sentinel paste label' }
})

const command = useCoreCommands().find(
(cmd) => cmd.id === 'Comfy.Canvas.PasteFromClipboardWithConnect'
)!
Expand All @@ -328,6 +331,7 @@ describe('useCoreCommands', () => {
i18n.global.mergeLocaleMessage('en', {
[menuLabels]: { [key]: original }
})
i18n.global.locale.value = previousLocale
}
})
})
Expand Down
15 changes: 15 additions & 0 deletions src/i18n.catalog.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { beforeEach, describe, expect, it } from 'vitest'

import mainMessages from './locales/en/main.json' with { type: 'json' }

import { i18n, t, te } from './i18n'

// Deliberately unmocked, unlike i18n.test.ts: these assertions are only
Expand All @@ -26,3 +28,16 @@ describe('locale keys referenced from source', () => {
).toContain('sd_xl_base.safetensors')
})
})

// buildLocale overwrites these namespaces with the generated catalogs, while
// eslint.config.ts reads main.json and those catalogs as separate localeDir
// entries and unions them. A key here would therefore pass lint and resolve to
// nothing at runtime.
describe('main.json', () => {
it.for([['commands'], ['nodeDefs'], ['settings']])(
'leaves %s to the generated catalog',
([namespace]) => {
expect(mainMessages).not.toHaveProperty(namespace)
}
)
})
19 changes: 0 additions & 19 deletions src/locales/ar/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "اسم سير العمل",
"workflowNamePlaceholder": "نصيحة: أدخل اسمًا وصفيًا يسهل البحث عنه"
},
"commands": {
"clear": "مسح سير العمل",
"clipspace": "فتح مساحة القص",
"dark": "داكن",
"execute": "تنفيذ",
"help": "مساعدة",
"interrupt": "إلغاء التشغيل الحالي",
"light": "فاتح",
"manageExtensions": "إدارة الإضافات",
"queue": "لوحة قائمة الانتظار",
"refresh": "تحديث تعريفات العقد",
"resetView": "إعادة تعيين عرض اللوحة",
"run": "تشغيل",
"runWorkflow": "تشغيل سير العمل",
"runWorkflowFront": "تشغيل سير العمل (إضافة في المقدمة)",
"settings": "الإعدادات",
"theme": "المظهر",
"toggleBottomPanel": "تبديل اللوحة السفلية"
},
"compositor": {
"downloadPsd": "تحميل PSD",
"empty": "شغّل سير العمل لإنشاء تركيب",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "Titel",
"workflowNamePlaceholder": "Tipp: Geben Sie einen aussagekräftigen, leicht auffindbaren Namen ein"
},
"commands": {
"clear": "Workflow leeren",
"clipspace": "Clipspace öffnen",
"dark": "Dunkel",
"execute": "Ausführen",
"help": "Hilfe",
"interrupt": "Aktuelle Ausführung abbrechen",
"light": "Hell",
"manageExtensions": "Erweiterungen",
"queue": "Warteschlangenbereich",
"refresh": "Node-Definitionen aktualisieren",
"resetView": "Canvas-Ansicht zurücksetzen",
"run": "Ausführen",
"runWorkflow": "Workflow ausführen",
"runWorkflowFront": "Workflow ausführen (Vorne einreihen)",
"settings": "Einstellungen",
"theme": "Design",
"toggleBottomPanel": "Unteres Bedienfeld ein-/ausblenden"
},
"compositor": {
"downloadPsd": "PSD herunterladen",
"empty": "Führen Sie den Workflow aus, um eine Komposition zu erstellen",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1445,25 +1445,6 @@
"white": "White",
"negative": "Negative"
},
"commands": {
"runWorkflow": "Run workflow",
"runWorkflowFront": "Run workflow (Queue at front)",
"run": "Run",
"execute": "Execute",
"interrupt": "Cancel current run",
"refresh": "Refresh node definitions",
"clipspace": "Open Clipspace",
"resetView": "Reset canvas view",
"clear": "Clear workflow",
"toggleBottomPanel": "Toggle Bottom Panel",
"theme": "Theme",
"dark": "Dark",
"light": "Light",
"manageExtensions": "Extensions",
"settings": "Settings",
"help": "Help",
"queue": "Queue Panel"
},
"queue": {
"initializingAlmostReady": "Initializing - Almost ready",
"inQueue": "In queue...",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/es/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "Nombre del flujo de trabajo",
"workflowNamePlaceholder": "Consejo: ingresa un nombre descriptivo y fácil de buscar"
},
"commands": {
"clear": "Limpiar flujo de trabajo",
"clipspace": "Abrir Clipspace",
"dark": "Oscuro",
"execute": "Ejecutar",
"help": "Ayuda",
"interrupt": "Cancelar ejecución actual",
"light": "Claro",
"manageExtensions": "Gestionar extensiones",
"queue": "Panel de cola",
"refresh": "Actualizar definiciones de nodos",
"resetView": "Restablecer vista del lienzo",
"run": "Ejecutar",
"runWorkflow": "Ejecutar flujo de trabajo",
"runWorkflowFront": "Ejecutar flujo de trabajo (Encolar al principio)",
"settings": "Configuración",
"theme": "Tema",
"toggleBottomPanel": "Alternar panel inferior"
},
"compositor": {
"downloadPsd": "Descargar PSD",
"empty": "Ejecuta el flujo de trabajo para generar un compuesto",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/fa/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "نام جریان‌کار",
"workflowNamePlaceholder": "نکته: یک نام توصیفی وارد کنید که به راحتی قابل جستجو باشد"
},
"commands": {
"clear": "پاک‌سازی workflow",
"clipspace": "باز کردن Clipspace",
"dark": "تاریک",
"execute": "اجرا",
"help": "راهنما",
"interrupt": "لغو اجرای فعلی",
"light": "روشن",
"manageExtensions": "مدیریت افزونه‌ها",
"queue": "پنل صف",
"refresh": "به‌روزرسانی تعاریف node",
"resetView": "بازنشانی نمای canvas",
"run": "اجرا",
"runWorkflow": "اجرای workflow",
"runWorkflowFront": "اجرای workflow (صف در ابتدا)",
"settings": "تنظیمات",
"theme": "پوسته",
"toggleBottomPanel": "نمایش/مخفی‌سازی پنل پایین"
},
"compositor": {
"downloadPsd": "دانلود PSD",
"empty": "برای ایجاد ترکیب، ورک‌فلو را اجرا کنید",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/fr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "Nom du workflow",
"workflowNamePlaceholder": "Astuce : saisissez un nom descriptif facile à rechercher"
},
"commands": {
"clear": "Effacer le workflow",
"clipspace": "Ouvrir Clipspace",
"dark": "Sombre",
"execute": "Exécuter",
"help": "Aide",
"interrupt": "Annuler l'exécution en cours",
"light": "Clair",
"manageExtensions": "Gérer les extensions",
"queue": "Panneau de file d'attente",
"refresh": "Actualiser les définitions de nœud",
"resetView": "Réinitialiser la vue du canevas",
"run": "Exécuter",
"runWorkflow": "Exécuter le workflow",
"runWorkflowFront": "Exécuter le workflow (Mettre en file d'attente en premier)",
"settings": "Paramètres",
"theme": "Thème",
"toggleBottomPanel": "Basculer le panneau inférieur"
},
"compositor": {
"downloadPsd": "Télécharger le PSD",
"empty": "Exécutez le workflow pour générer un composite",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/he/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "שם תהליך העבודה",
"workflowNamePlaceholder": "טיפ: הזן שם תיאורי שקל לחפש"
},
"commands": {
"clear": "ניקוי תהליך העבודה",
"clipspace": "פתיחת Clipspace",
"dark": "כהה",
"execute": "ביצוע",
"help": "עזרה",
"interrupt": "ביטול ההרצה הנוכחית",
"light": "בהיר",
"manageExtensions": "הרחבות",
"queue": "פאנל התור",
"refresh": "רענון הגדרות הצמתים",
"resetView": "איפוס תצוגת הקנבס",
"run": "הרצה",
"runWorkflow": "הרצת תהליך העבודה",
"runWorkflowFront": "הרצת תהליך העבודה (הוספה לראש התור)",
"settings": "הגדרות",
"theme": "ערכת נושא",
"toggleBottomPanel": "הצגה/הסתרה של הפאנל התחתון"
},
"compositor": {
"downloadPsd": "הורד PSD",
"empty": "הרץ את תהליך העבודה כדי ליצור קומפוזיט",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/it/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "Titolo",
"workflowNamePlaceholder": "Suggerimento: inserisci un nome descrittivo facile da cercare"
},
"commands": {
"clear": "Cancella workflow",
"clipspace": "Apri Clipspace",
"dark": "Scuro",
"execute": "Esegui",
"help": "Aiuto",
"interrupt": "Annulla esecuzione corrente",
"light": "Chiaro",
"manageExtensions": "Estensioni",
"queue": "Pannello Coda",
"refresh": "Aggiorna definizioni nodo",
"resetView": "Reimposta vista canvas",
"run": "Esegui",
"runWorkflow": "Esegui workflow",
"runWorkflowFront": "Esegui workflow (Metti in cima alla coda)",
"settings": "Impostazioni",
"theme": "Tema",
"toggleBottomPanel": "Mostra/Nascondi Pannello Inferiore"
},
"compositor": {
"downloadPsd": "Scarica PSD",
"empty": "Esegui il workflow per generare una composizione",
Expand Down
19 changes: 0 additions & 19 deletions src/locales/ja/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,25 +963,6 @@
"workflowName": "ワークフロー名",
"workflowNamePlaceholder": "ヒント:検索しやすい説明的な名前を入力してください"
},
"commands": {
"clear": "ワークフローをクリア",
"clipspace": "Clipspaceを開く",
"dark": "ダーク",
"execute": "実行",
"help": "ヘルプ",
"interrupt": "現在の実行をキャンセル",
"light": "ライト",
"manageExtensions": "拡張機能を管理",
"queue": "キューパネル",
"refresh": "ノード定義を更新",
"resetView": "キャンバスビューをリセット",
"run": "実行",
"runWorkflow": "ワークフローを実行",
"runWorkflowFront": "ワークフローを実行(先頭に追加)",
"settings": "設定",
"theme": "テーマ",
"toggleBottomPanel": "下部パネルの切り替え"
},
"compositor": {
"downloadPsd": "PSDをダウンロード",
"empty": "ワークフローを実行して合成画像を生成してください",
Expand Down
Loading
Loading