diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index 63f8d80..1c1c381 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -123,7 +123,7 @@ b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py 44127adcfa30ee84bff9cd4b2d0c695355209550e76982d374122008728aa5bc reference_audio.py 5cb9bfd6810d3a93a637451980a4cc5c1436e5b84cfd1c7a111cd192e876351b reference_video.py c7b14ed6f8cfc2a1f0a21db4fe56fba75a93ffcb0be0c22bbd2e691c45cd0e2d reference.py -6a943937d0e19686d365c9db5b771493172874c5772bb96f6c3a437d83402b04 REGISTRY_MANIFEST.sha256 +6f4e873fd1b25141b0d0b4bd2bbb83dca1591d753609c7f0ccbb2106828ef3bf REGISTRY_MANIFEST.sha256 467edb2c188d024c2392aafe7423b3f835e16b10f570da76e2f7dda8a962c1c5 requirements.txt 8bfa113a2ec11325619be300b4d2b53a157b1d2c1ef7855057a4b3bbd05aeef3 run_storage.py 6056de6c0a5322a8a51ba5a114538dca2ef67788cd1afba10fedd483b95f6afa state_io.py @@ -137,7 +137,7 @@ a41a4de12e6fe5690845f9f0795fa82c4907f0afe2551034fa2a4c95617ac39c tests/decode_c 549698d35918b611adc4e8f3aa2f0568c19291b4825cc3c593f3f63e77ec5844 tests/decode_cache/test_process_isolation.py 7e627131904dc6d6f58021fad396185c531858b62dd6febf12c3f95fd1391138 tests/decode_cache/test_store.py db08ce77cc5c5835f2403d4d589394090fa5d25ff3b1840312b2808e1bc203b7 tests/fixtures/v38_a3c_selective_refine_saved_workflow.json -ee4b2da3dd858d99aacd9053251ffc638ad408cdac2d3a04b1fc2a2af62a60d5 tests/frontend_decode_cache_helper.mjs +606b3985f2b644fac40c84de3e08d1453e87a988acca51ce9595516a7c60a577 tests/frontend_decode_cache_helper.mjs 94b11903eff9a1805001617477d9066b47f856e4e102b381d8d528c0a100e0d2 tests/frontend_review_queue.cjs 36f74c03a40c4b62b90eede070d976bcd1b7f0ea828983d1e61a6cb6d80a0ea8 tests/helpers/r5_process_crash_worker.py 706029af8c8d979b2b700f5bc2b96a3064fe7c728f487698d9f079abb02e9409 tests/terminal_merge_diagnostics.py @@ -359,7 +359,7 @@ d0a004aa3030c8adaa5ea788f9acc758fcb4a556f203f9a3f63fa4e4b5772063 v3/sampling_en 4178dcfa442abdb06ce276e05bd7bcbaa6da28469ba5e57d3da3c663de4e4a9d v3/video_seam_v35.py 2f07ace1462644f0bee553827b3571535de4d0c2d9ef847bd9e0ca73a4eed5cb v3/video_seam.py 453c98485ec55cca959aa5863ac35ae3b86c4781ae95c9e52ac9f1d9115c9eed version.py -c32b57a979071974662c36f27967b65b01fa2cae552a094df4731de9d3522751 web/decode_cache_helper.js +685df8e0fa23e3663ab31da1e4470cd19bdaa0dc16362cb606e874d9d6153c2c web/decode_cache_helper.js c2883272b05a9a9146b5c6cf614ddae8a3e6893cd910902023aae61360195289 web/easy_bypass_toggle.js 092088096307d33ac016b82b4774ca38845a2ff2f63b97ac6da8c5aca4fea413 web/easy_load_audio.js 9db0aa94f634578a962d5db49e5c70356040a59df968e3a2e531b327a623081f web/easy_load_image.js diff --git a/REGISTRY_MANIFEST.sha256 b/REGISTRY_MANIFEST.sha256 index a52aa85..21ac9b0 100644 --- a/REGISTRY_MANIFEST.sha256 +++ b/REGISTRY_MANIFEST.sha256 @@ -108,7 +108,7 @@ d0a004aa3030c8adaa5ea788f9acc758fcb4a556f203f9a3f63fa4e4b5772063 v3/sampling_en 4178dcfa442abdb06ce276e05bd7bcbaa6da28469ba5e57d3da3c663de4e4a9d v3/video_seam_v35.py 2f07ace1462644f0bee553827b3571535de4d0c2d9ef847bd9e0ca73a4eed5cb v3/video_seam.py 453c98485ec55cca959aa5863ac35ae3b86c4781ae95c9e52ac9f1d9115c9eed version.py -c32b57a979071974662c36f27967b65b01fa2cae552a094df4731de9d3522751 web/decode_cache_helper.js +685df8e0fa23e3663ab31da1e4470cd19bdaa0dc16362cb606e874d9d6153c2c web/decode_cache_helper.js c2883272b05a9a9146b5c6cf614ddae8a3e6893cd910902023aae61360195289 web/easy_bypass_toggle.js 092088096307d33ac016b82b4774ca38845a2ff2f63b97ac6da8c5aca4fea413 web/easy_load_audio.js 9db0aa94f634578a962d5db49e5c70356040a59df968e3a2e531b327a623081f web/easy_load_image.js diff --git a/tests/frontend_decode_cache_helper.mjs b/tests/frontend_decode_cache_helper.mjs index f4eaf46..fc902b4 100644 --- a/tests/frontend_decode_cache_helper.mjs +++ b/tests/frontend_decode_cache_helper.mjs @@ -3,7 +3,11 @@ import fs from "node:fs"; const source = fs.readFileSync(new URL("../web/decode_cache_helper.js", import.meta.url), "utf8"); let extension; -globalThis.__h3TestApp = { registerExtension(value) { extension = value; }, graph: { _nodes: [] } }; +globalThis.__h3TestApp = { + registerExtension(value) { extension = value; }, + graph: { _nodes: [] }, + ui: { settings: { getSettingValue: () => "en" } }, +}; const module = await import(`data:text/javascript;base64,${Buffer.from(source.replace( 'import { app } from "../../scripts/app.js";', 'const app = globalThis.__h3TestApp;', )).toString("base64")}`); @@ -34,10 +38,10 @@ assert.equal(token.hidden, true); assert.equal(token.options.hidden, true); assert.equal(token.options.serialize, undefined); assert.equal(button.type, "button"); -assert.equal(button.name, "キャッシュをクリア"); +assert.equal(button.name, "Clear cache"); assert.equal(button.options.serialize, false); assert.equal(button.serialize, false); -assert.match(button.tooltip, /次回Queue/); +assert.match(button.tooltip, /next Queue/); assert.deepEqual(node.serialize().widgets_values, ["Auto", 256, 8, 0]); extension.loadedGraphNode(node); globalThis.__h3TestApp.graph._nodes = [node]; @@ -77,4 +81,11 @@ assert.equal(other.widgets.length, 4); assert.equal(other.widgets[3].hidden, undefined); // Without JS the native reset_token input remains untouched. assert.equal(createNode().widgets[3].type, "number"); + +// ComfyUI's explicit locale setting takes precedence over browser language. +globalThis.__h3TestApp.ui = { settings: { getSettingValue: () => "ja" } }; +const japaneseNode = createNode(); +extension.nodeCreated(japaneseNode); +assert.equal(japaneseNode.widgets[4].name, "キャッシュをクリア"); +assert.match(japaneseNode.widgets[4].tooltip, /次回Queue/); console.log("Decode Cache Helper frontend lifecycle / serialization / clone / standard workflows: PASS"); diff --git a/web/decode_cache_helper.js b/web/decode_cache_helper.js index d8c1dcb..42d5b4f 100644 --- a/web/decode_cache_helper.js +++ b/web/decode_cache_helper.js @@ -2,8 +2,34 @@ import { app } from "../../scripts/app.js"; const NODE_CLASS = "H3DecodeCacheHelper"; const MAX_TOKEN = 2147483647; -const BUTTON_NAME = "キャッシュをクリア"; -const TOOLTIP = "次回QueueでこのHelperのキャッシュを破棄します。次回は通常Decodeとなります。普段は操作不要です。"; + +function isJapanese() { + let locale = ""; + try { + locale = String(app?.ui?.settings?.getSettingValue?.("Comfy.Locale") || ""); + } catch {} + if (!locale) { + locale = String( + globalThis.document?.documentElement?.lang + || globalThis.navigator?.language + || "en", + ); + } + return /^ja(?:-|$)/i.test(locale); +} + +function labels() { + if (isJapanese()) { + return { + button: "キャッシュをクリア", + tooltip: "次回QueueでこのHelperのキャッシュを破棄します。次回は通常Decodeとなります。普段は操作不要です。", + }; + } + return { + button: "Clear cache", + tooltip: "Clear this Helper's cache on the next Queue. The next run uses normal Decode. Usually no action is needed.", + }; +} // Keep the backend widget in its original position. Only its presentation is // hidden; Core still serializes and sends reset_token as an INT. @@ -30,9 +56,10 @@ export function configureDecodeCacheHelper(node) { const token = node.widgets?.find((widget) => widget.name === "reset_token"); if (!token || typeof node.addWidget !== "function") return; if (!node.__h3DecodeCacheClearButton) { + const text = labels(); // Create the control before hiding the numeric widget, so a failed // control installation leaves the traditional input available. - const button = node.addWidget("button", BUTTON_NAME, null, () => { + const button = node.addWidget("button", text.button, null, () => { const current = node.widgets?.find((widget) => widget.name === "reset_token"); if (!current) return; const value = Number(current.value); @@ -44,7 +71,7 @@ export function configureDecodeCacheHelper(node) { button.serialize = false; button.options ||= {}; button.options.serialize = false; - button.tooltip = TOOLTIP; + button.tooltip = text.tooltip; node.__h3DecodeCacheClearButton = button; // Some frontend versions assign widgets_values by index even for