Skip to content

Commit 22c70d5

Browse files
christian-byrnegithub-actions
andauthored
[fix] use getter functions for sidebar tab command labels to resolve i18n collection issues (#4370)
Co-authored-by: github-actions <github-actions@github.com>
1 parent f5b03f3 commit 22c70d5

File tree

16 files changed

+84
-24
lines changed

16 files changed

+84
-24
lines changed

scripts/check-unused-i18n-keys.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ const IGNORE_PATTERNS = [
1717
/^templateWorkflows\./, // Template workflows are loaded dynamically
1818
/^dataTypes\./, // Data types might be referenced dynamically
1919
/^contextMenu\./, // Context menu items might be dynamic
20-
/^color\./ // Color names might be used dynamically
20+
/^color\./, // Color names might be used dynamically
21+
// Auto-generated categories from collect-i18n-general.ts
22+
/^menuLabels\./, // Menu labels generated from command labels
23+
/^settingsCategories\./, // Settings categories generated from setting definitions
24+
/^serverConfigItems\./, // Server config items generated from SERVER_CONFIG_ITEMS
25+
/^serverConfigCategories\./, // Server config categories generated from config categories
26+
/^nodeCategories\./, // Node categories generated from node definitions
27+
// Setting option values that are dynamically generated
28+
/\.options\./ // All setting options are rendered dynamically
2129
]
2230

2331
// Get list of staged locale files
@@ -97,17 +105,21 @@ function shouldIgnoreKey(key: string): boolean {
97105

98106
// Search for key usage in source files
99107
function isKeyUsed(key: string, sourceFiles: string[]): boolean {
108+
// Escape special regex characters
109+
const escapeRegex = (str: string) =>
110+
str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
111+
const escapedKey = escapeRegex(key)
112+
const lastPart = key.split('.').pop()
113+
const escapedLastPart = lastPart ? escapeRegex(lastPart) : ''
114+
100115
// Common patterns for i18n key usage
101116
const patterns = [
102117
// Direct usage: $t('key'), t('key'), i18n.t('key')
103-
new RegExp(`[t$]\\s*\\(\\s*['"\`]${key}['"\`]`, 'g'),
118+
new RegExp(`[t$]\\s*\\(\\s*['"\`]${escapedKey}['"\`]`, 'g'),
104119
// With namespace: $t('g.key'), t('namespace.key')
105-
new RegExp(
106-
`[t$]\\s*\\(\\s*['"\`][^'"]+\\.${key.split('.').pop()}['"\`]`,
107-
'g'
108-
),
120+
new RegExp(`[t$]\\s*\\(\\s*['"\`][^'"]+\\.${escapedLastPart}['"\`]`, 'g'),
109121
// Dynamic keys might reference parts of the key
110-
new RegExp(`['"\`]${key}['"\`]`, 'g')
122+
new RegExp(`['"\`]${escapedKey}['"\`]`, 'g')
111123
]
112124

113125
for (const file of sourceFiles) {

src/locales/en/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,8 @@
949949
"Light": "Light",
950950
"User": "User",
951951
"Credits": "Credits",
952-
"API Nodes": "API Nodes"
952+
"API Nodes": "API Nodes",
953+
"Notification Preferences": "Notification Preferences"
953954
},
954955
"serverConfigItems": {
955956
"listen": {

src/locales/en/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@
263263
"name": "Number of nodes suggestions",
264264
"tooltip": "Only for litegraph searchbox/context menu"
265265
},
266+
"Comfy_Notification_ShowVersionUpdates": {
267+
"name": "Show version updates",
268+
"tooltip": "Show updates for new models, and major new features."
269+
},
266270
"Comfy_Pointer_ClickBufferTime": {
267271
"name": "Pointer click drift delay",
268272
"tooltip": "After pressing a pointer button down, this is the maximum time (in milliseconds) that pointer movement can be ignored for.\n\nHelps prevent objects from being unintentionally nudged if the pointer is moved whilst clicking."

src/locales/es/main.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,13 @@
785785
"Toggle Bottom Panel": "Alternar panel inferior",
786786
"Toggle Focus Mode": "Alternar modo de enfoque",
787787
"Toggle Logs Bottom Panel": "Alternar panel inferior de registros",
788-
"Toggle Model Library Sidebar": "Alternar barra lateral de biblioteca de modelos",
789-
"Toggle Node Library Sidebar": "Alternar barra lateral de biblioteca de nodos",
790-
"Toggle Queue Sidebar": "Alternar barra lateral de cola",
788+
"Toggle Model Library Sidebar": "Alternar barra lateral de la biblioteca de modelos",
789+
"Toggle Node Library Sidebar": "Alternar barra lateral de la biblioteca de nodos",
790+
"Toggle Queue Sidebar": "Alternar barra lateral de la cola",
791791
"Toggle Search Box": "Alternar caja de búsqueda",
792792
"Toggle Terminal Bottom Panel": "Alternar panel inferior de terminal",
793793
"Toggle Theme (Dark/Light)": "Alternar tema (Oscuro/Claro)",
794-
"Toggle Workflows Sidebar": "Alternar barra lateral de flujos de trabajo",
794+
"Toggle Workflows Sidebar": "Alternar barra lateral de los flujos de trabajo",
795795
"Toggle the Custom Nodes Manager": "Alternar el Administrador de Nodos Personalizados",
796796
"Toggle the Custom Nodes Manager Progress Bar": "Alternar la Barra de Progreso del Administrador de Nodos Personalizados",
797797
"Undo": "Deshacer",
@@ -1099,6 +1099,7 @@
10991099
"Node Search Box": "Caja de Búsqueda de Nodo",
11001100
"Node Widget": "Widget de Nodo",
11011101
"NodeLibrary": "Biblioteca de Nodos",
1102+
"Notification Preferences": "Preferencias de notificación",
11021103
"Pointer": "Puntero",
11031104
"Queue": "Cola",
11041105
"QueueButton": "Botón de Cola",

src/locales/es/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@
259259
"name": "Destacar nodo de ajuste",
260260
"tooltip": "Al arrastrar un enlace sobre un nodo con ranura de entrada viable, resalta el nodo"
261261
},
262+
"Comfy_Notification_ShowVersionUpdates": {
263+
"name": "Mostrar actualizaciones de versión",
264+
"tooltip": "Mostrar actualizaciones para nuevos modelos y funciones principales nuevas."
265+
},
262266
"Comfy_Pointer_ClickBufferTime": {
263267
"name": "Retraso de deriva del clic del puntero",
264268
"tooltip": "Después de presionar un botón del puntero, este es el tiempo máximo (en milisegundos) que se puede ignorar el movimiento del puntero.\n\nAyuda a prevenir que los objetos sean movidos involuntariamente si el puntero se mueve al hacer clic."

src/locales/fr/main.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,13 @@
785785
"Toggle Bottom Panel": "Basculer le panneau inférieur",
786786
"Toggle Focus Mode": "Basculer le mode focus",
787787
"Toggle Logs Bottom Panel": "Basculer le panneau inférieur des journaux",
788-
"Toggle Model Library Sidebar": "Basculer la barre latérale de la bibliothèque de modèles",
789-
"Toggle Node Library Sidebar": "Basculer la barre latérale de la bibliothèque de nœuds",
790-
"Toggle Queue Sidebar": "Basculer la barre latérale de la file d'attente",
788+
"Toggle Model Library Sidebar": "Afficher/Masquer la barre latérale de la bibliothèque de modèles",
789+
"Toggle Node Library Sidebar": "Afficher/Masquer la barre latérale de la bibliothèque de nœuds",
790+
"Toggle Queue Sidebar": "Afficher/Masquer la barre latérale de la file dattente",
791791
"Toggle Search Box": "Basculer la boîte de recherche",
792792
"Toggle Terminal Bottom Panel": "Basculer le panneau inférieur du terminal",
793793
"Toggle Theme (Dark/Light)": "Basculer le thème (Sombre/Clair)",
794-
"Toggle Workflows Sidebar": "Basculer la barre latérale des flux de travail",
794+
"Toggle Workflows Sidebar": "Afficher/Masquer la barre latérale des workflows",
795795
"Toggle the Custom Nodes Manager": "Basculer le gestionnaire de nœuds personnalisés",
796796
"Toggle the Custom Nodes Manager Progress Bar": "Basculer la barre de progression du gestionnaire de nœuds personnalisés",
797797
"Undo": "Annuler",
@@ -1099,6 +1099,7 @@
10991099
"Node Search Box": "Boîte de Recherche de Nœud",
11001100
"Node Widget": "Widget de Nœud",
11011101
"NodeLibrary": "Bibliothèque de Nœuds",
1102+
"Notification Preferences": "Préférences de notification",
11021103
"Pointer": "Pointeur",
11031104
"Queue": "File d'Attente",
11041105
"QueueButton": "Bouton de File d'Attente",

src/locales/fr/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@
259259
"name": "Le snap met en évidence le nœud",
260260
"tooltip": "Lorsque vous faites glisser un lien sur un nœud avec une fente d'entrée viable, mettez en évidence le nœud"
261261
},
262+
"Comfy_Notification_ShowVersionUpdates": {
263+
"name": "Afficher les mises à jour de version",
264+
"tooltip": "Afficher les mises à jour pour les nouveaux modèles et les nouvelles fonctionnalités majeures."
265+
},
262266
"Comfy_Pointer_ClickBufferTime": {
263267
"name": "Délai de dérive du clic du pointeur",
264268
"tooltip": "Après avoir appuyé sur un bouton de pointeur, c'est le temps maximum (en millisecondes) que le mouvement du pointeur peut être ignoré.\n\nAide à prévenir que les objets soient déplacés involontairement si le pointeur est déplacé lors du clic."

src/locales/ja/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@
10991099
"Node Search Box": "ノード検索ボックス",
11001100
"Node Widget": "ノードウィジェット",
11011101
"NodeLibrary": "ノードライブラリ",
1102+
"Notification Preferences": "通知設定",
11021103
"Pointer": "ポインタ",
11031104
"Queue": "キュー",
11041105
"QueueButton": "キューボタン",

src/locales/ja/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@
259259
"name": "スナップハイライトノード",
260260
"tooltip": "有効な入力スロットを持つノードの上にリンクをドラッグすると、ノードがハイライトされます"
261261
},
262+
"Comfy_Notification_ShowVersionUpdates": {
263+
"name": "バージョン更新を表示",
264+
"tooltip": "新しいモデルや主要な新機能のアップデートを表示します。"
265+
},
262266
"Comfy_Pointer_ClickBufferTime": {
263267
"name": "ポインタークリックドリフト遅延",
264268
"tooltip": "ポインターボタンを押した後、ポインタの動きが無視される最大時間(ミリ秒単位)です。\n\nクリック中にポインタが移動した場合、オブジェクトが意図せず動かされるのを防ぎます。"

src/locales/ko/main.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,11 @@
787787
"Toggle Logs Bottom Panel": "로그 하단 패널 전환",
788788
"Toggle Model Library Sidebar": "모델 라이브러리 사이드바 전환",
789789
"Toggle Node Library Sidebar": "노드 라이브러리 사이드바 전환",
790-
"Toggle Queue Sidebar": "실행 대기열 사이드바 전환",
790+
"Toggle Queue Sidebar": "대기열 사이드바 전환",
791791
"Toggle Search Box": "검색 상자 전환",
792792
"Toggle Terminal Bottom Panel": "터미널 하단 패널 전환",
793793
"Toggle Theme (Dark/Light)": "테마 전환 (어두운/밝은)",
794-
"Toggle Workflows Sidebar": "워크플로 사이드바 전환",
794+
"Toggle Workflows Sidebar": "워크플로우 사이드바 전환",
795795
"Toggle the Custom Nodes Manager": "커스텀 노드 매니저 전환",
796796
"Toggle the Custom Nodes Manager Progress Bar": "커스텀 노드 매니저 진행률 표시줄 전환",
797797
"Undo": "실행 취소",
@@ -1099,6 +1099,7 @@
10991099
"Node Search Box": "노드 검색 상자",
11001100
"Node Widget": "노드 위젯",
11011101
"NodeLibrary": "노드 라이브러리",
1102+
"Notification Preferences": "알림 환경설정",
11021103
"Pointer": "포인터",
11031104
"Queue": "실행 대기열",
11041105
"QueueButton": "실행 대기열 버튼",

0 commit comments

Comments
 (0)