From 533b7757182ab45ea58e69c7799aa0082b7ba471 Mon Sep 17 00:00:00 2001 From: journey-ad Date: Tue, 29 Aug 2023 09:14:56 +0800 Subject: [PATCH] docs: Add scope CSS selector --- README.md | 10 ++++++---- README_JA.md | 10 ++++++---- README_ZH.md | 6 ++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1dda7d0..abb32b2 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,16 @@ In Settings - Bilingual Localization panel, select the loc ## Scoped -Localization supports scoped to prevent global impact. The syntax rule is `####`. -Scoped text is effective only when the ID of the ancestor element of the node matches the specified scope. +Localization supports scoped to prevent global polluting. The syntax rules are as follows: +- `####` Scoped text will only take effect when the ancestor element ID matches the specified scope. +- `##@##` Scoped text will only take effect when the ancestor element matches the specified CSS selector. ```json { ... - "##tab_ti##Normal": "正态", // only `Normal` under the element with id="tab_ti" will be translated to `正态`. - "##tab_threedopenpose##Normal": "法线图", // only `Normal` under the element with id="tab_threedopenpose" will be translated to `法线图`. + "##tab_ti##Normal": "正态", // only the text `Normal` under the element with id="tab_ti" will be translated to `正态`. + "##tab_threedopenpose##Normal": "法线图", // only the text `Normal` under the element with id="tab_threedopenpose" will be translated to `法线图`. + "##@.extra-networks .tab-nav button##Lora": "Lora模型", // only the text `Lora` under the element with class=".extra-networks .tab-nav button" will be translated to `Lora模型`. ... } ``` diff --git a/README_JA.md b/README_JA.md index a9cf7c9..12b5038 100644 --- a/README_JA.md +++ b/README_JA.md @@ -52,13 +52,15 @@ git clone https://github.com/journey-ad/sd-webui-bilingual-localization extensio ## スコープ -ローカライゼーションは、スコープ化されており、グローバルな影響を防止することができます。構文ルールは`####`です。 -スコープを指定するIDが祖先要素のIDと一致する場合にのみ、スコープ化されたテキストが有効になります。 +ローカリゼーションは、グローバルな影響を防ぐためにスコープを限定したサポートを提供します。構文規則は以下の通りです: +- `####` スコープが指定された要素の祖先のIDと一致する場合にのみ、スコープ付きのテキストが適用されます。 +- `##@##` スコープが指定されたCSSセレクタと一致する場合にのみ、スコープ付きのテキストが適用されます。 ```json ... - "##tab_ti##Normal": "正常", // id="tab_ti"要素の下の`Normal`のみが`正常`として変換されます - "##tab_threedopenpose##Normal": "法線マップ", // id="tab_threedopenpose"要素の下の`Normal`のみが `法線マップ`として変換されます + "##tab_ti##Normal": "正常", // id="tab_ti"の要素の下にある`Normal`のみが`正常`に変換されます + "##tab_threedopenpose##Normal": "法線マップ", // id="tab_threedopenpose"の要素の下にある`Normal`のみが `法線マップ`に変換されます + "##@.extra-networks .tab-nav button##Lora": "Loraモデル", // class=".extra-networks .tab-nav button"の要素の下にある`Lora`のみが`Loraモデル`に変換されます ... ``` diff --git a/README_ZH.md b/README_ZH.md index e688ee8..87935d9 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -48,14 +48,16 @@ git clone https://github.com/journey-ad/sd-webui-bilingual-localization extensio ## 作用域支持 -本地化语料支持限定作用域,防止影响全局翻译,语法规则`####` -具有作用域的语料仅当节点祖先元素的ID匹配指定的作用域时才会生效 +本地化语料支持限定作用域,防止影响全局翻译,语法规则: +- `####` 仅当节点祖先元素ID匹配指定的作用域时才会生效 +- `##@##` 仅当节点祖先元素匹配指定的CSS选择器时才会生效 ```json { ... "##tab_ti##Normal": "正态", // 仅id="tab_ti"元素下的`Normal`会被翻译为`正态` "##tab_threedopenpose##Normal": "法线图", // 仅id="tab_threedopenpose"元素下的`Normal`会被翻译为`法线图` + "##@.extra-networks .tab-nav button##Lora": "Lora模型", // 仅class=".extra-networks .tab-nav button"元素下的`Lora`会被翻译为`Lora模型` ... } ```