Skip to content
Open
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
[中文文档](README_ZH.md) / [日本語](README_JA.md)

# About this mod
Resolved bug [issues#51](https://github.com/journey-ad/sd-webui-bilingual-localization/issues/51) (translation display issue), as the author has not updated for 8 months (as of April 6, 2024), so I had to make modifications independently, and additionally introduced some comfort optimization adjustments.

For better English learning, improve comfort by:
1. Adjusting the priority relationship between languages in the upper and lower positions of the interface to enhance hierarchy (for learning English, please set English to the upper position)
2. Adding an option to translate the default placeholder text in the inputbox (because translating within the inputbox may affect the interface aesthetics)
----

<p align="center"><img src="https://count.getloli.com/get/@sd-webui-bilingual-localization.github" alt="sd-webui-bilingual-localization"></p>

# sd-webui-bilingual-localization
Expand Down
7 changes: 7 additions & 0 deletions README_JA.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[English Version](README.md)

# このモッドについて
[issues#51](https://github.com/journey-ad/sd-webui-bilingual-localization/issues/51)番のバグ(翻訳表示の問題)が修正されました。著者は8ヶ月間更新されていないため(2024年4月6日時点)、私は独自に修正し、さらにいくつかの快適性の最適化調整を行いました。

より良い英語学習のため、快適性を向上させます:
1. インターフェースの上下位置の言語の優先関係を調整し、階層感を高めます(英語を学習する場合は、英語を上位に設定してください)。
2. 入力ボックスのデフォルトのプレースホルダーテキストを翻訳する必要があるかどうかのオプションを追加します(入力ボックス内での翻訳は、インターフェースの美観に影響を及ぼす可能性があるため)。

<p align="center"><img src="https://count.getloli.com/get/@sd-webui-bilingual-localization.github" alt="sd-webui-bilingual-localization"></p>

# sd-webui-bilingual-localization
Expand Down
9 changes: 9 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
[English Version](README.md)

# 关于这个mod
修复了[issues#51](https://github.com/journey-ad/sd-webui-bilingual-localization/issues/51)(无法显示翻译)这个bug,作者已经8个月没有更新了(24年4月6日),所以我只好自己修改,并且增加一些舒适性优化改动。

为了更好的学习英语,增加舒适性改动:
1. 调整界面中上下位置的语言的主次关系,增加层次感(学英文就请把英文设置到上方位置)
2. 增加输入框的默认占位文字是否需要翻译的选项(因为在输入框做翻译,界面会不太好看)

----

<p align="center"><img src="https://count.getloli.com/get/@sd-webui-bilingual-localization.github" alt="sd-webui-bilingual-localization"></p>

# sd-webui-bilingual-localization
Expand Down
11 changes: 7 additions & 4 deletions javascript/bilingual_localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
display: inline-flex;
flex-direction: column;
align-items: center;
font-size: 13px;
font-size: var(--section-header-text-size);
line-height: 1;
}

.bilingual__trans_wrapper em {
font-style: normal;
font-size: 10px;
padding-top: 4px;
margin-bottom: 8px;
}

#txtimg_hr_finalres .bilingual__trans_wrapper em,
Expand Down Expand Up @@ -40,7 +43,6 @@
.posex_setting_cont .bilingual__trans_wrapper:not(.posex_bg .bilingual__trans_wrapper), /* Posex extension */
#dynamic-prompting .bilingual__trans_wrapper
{
font-size: 12px;
align-items: flex-start;
}

Expand Down Expand Up @@ -103,7 +105,8 @@
file: opts["bilingual_localization_file"],
dirs: opts["bilingual_localization_dirs"],
order: opts["bilingual_localization_order"],
enableLogger: opts["bilingual_localization_logger"]
enableLogger: opts["bilingual_localization_logger"],
enableTransPlaceHolder: opts["bilingual_translate_placeholder"]
}

let { enabled, file, dirs, enableLogger } = config
Expand Down Expand Up @@ -227,7 +230,7 @@
doTranslate(el, el.title, 'title')
}

if (el.placeholder) {
if (el.placeholder && config.enableTransPlaceHolder === true) {
doTranslate(el, el.placeholder, 'placeholder')
}

Expand Down
4 changes: 4 additions & 0 deletions scripts/bilingual_localization_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ def on_ui_settings():
# translation order
shared.opts.add_option("bilingual_localization_order", shared.OptionInfo("Translation First", "Translation display order", gr.Radio, {"choices": ["Translation First", "Original First"]}, section=BL_SECTION))

# translate the inputbox's placeholder
shared.opts.add_option("bilingual_translate_placeholder", shared.OptionInfo(False, "Enable translate the inputbox's placeholder", section=BL_SECTION))

# all localization files path in hidden option
shared.opts.add_option("bilingual_localization_dirs", shared.OptionInfo(json.dumps(I18N_DIRS), "Localization dirs", section=BL_SECTION, component_args={"visible": False}))
shared.opts.data["bilingual_localization_dirs"] = json.dumps(I18N_DIRS)

script_callbacks.on_ui_settings(on_ui_settings)