From 6411a1dd1728f657df3d04224e560eed7ddc2f01 Mon Sep 17 00:00:00 2001 From: xbol0 Date: Wed, 9 Aug 2023 06:39:54 +0000 Subject: [PATCH] fix ui switch --- web/i18n/en_US.js | 5 +++++ web/i18n/zh_CN.js | 5 +++++ web/scripts/ui.js | 14 +++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/web/i18n/en_US.js b/web/i18n/en_US.js index a92873e4f..d10108147 100644 --- a/web/i18n/en_US.js +++ b/web/i18n/en_US.js @@ -13,8 +13,13 @@ export default { "ui.close_btn": "Close", "ui.queue_size": "Queue size: ", "ui.extra_options": "Extra options", + "ui.extra.batch_count": "Batch count", "ui.settings.title": "Settings", + "ui.list.view.prefix": "View ", + "ui.list.clear.prefix": "Clear ", + "ui.list.queue": "Queue", + "ui.list.history": "History", "ui.canvas_menu_add_node": "Add Node", "ui.canvas_menu_add_group": "Add Group", diff --git a/web/i18n/zh_CN.js b/web/i18n/zh_CN.js index 1ff84c36c..ad71312e6 100644 --- a/web/i18n/zh_CN.js +++ b/web/i18n/zh_CN.js @@ -13,8 +13,13 @@ export default { "ui.close_btn": "关闭", "ui.queue_size": "队列数量: ", "ui.extra_options": "额外选项", + "ui.extra.batch_count": "批次数量", "ui.settings.title": "设置", + "ui.list.view.prefix": "查看", + "ui.list.clear.prefix": "清除", + "ui.list.queue": "队列", + "ui.list.history": "历史", "ui.canvas_menu_add_node": "添加节点", "ui.canvas_menu_add_group": "添加组", diff --git a/web/scripts/ui.js b/web/scripts/ui.js index 8a9572c13..2f4123fc4 100644 --- a/web/scripts/ui.js +++ b/web/scripts/ui.js @@ -480,13 +480,13 @@ class ComfyList { ]), $el("div.comfy-list-actions", [ $el("button", { - textContent: "Clear " + this.#text, + textContent: i18next.t("ui.list.clear.prefix") + this.#text, onclick: async () => { await api.clearItems(this.#type); await this.load(); }, }), - $el("button", { textContent: "Refresh", onclick: () => this.load() }), + $el("button", { textContent: i18next.t("ui.refresh_btn"), onclick: () => this.load() }), ]) ); } @@ -499,14 +499,14 @@ class ComfyList { async show() { this.element.style.display = "block"; - this.button.textContent = "Close"; + this.button.textContent = i18next.t("ui.close_btn"); await this.load(); } hide() { this.element.style.display = "none"; - this.button.textContent = "View " + this.#text; + this.button.textContent = i18next.t("ui.list.view.prefix") + this.#text; } toggle() { @@ -528,8 +528,8 @@ export class ComfyUI { this.batchCount = 1; this.lastQueueSize = 0; - this.queue = new ComfyList("Queue"); - this.history = new ComfyList("History"); + this.queue = new ComfyList(i18next.t("ui.list.queue")); + this.history = new ComfyList(i18next.t("ui.list.history")); api.addEventListener("status", () => { this.queue.update(); @@ -617,7 +617,7 @@ export class ComfyUI { ]), ]), $el("div", { id: "extraOptions", style: { width: "100%", display: "none" } }, [ - $el("label", { innerHTML: "Batch count" }, [ + $el("label", { innerHTML: i18next.t("ui.extra.batch_count") }, [ $el("input", { id: "batchCountInputNumber", type: "number",