docs: Add scope CSS selector

main
journey-ad 2023-08-29 09:14:56 +08:00
parent e79b78402f
commit 533b775718
3 changed files with 16 additions and 10 deletions

View File

@ -51,14 +51,16 @@ In <kbd>Settings</kbd> - <kbd>Bilingual Localization</kbd> panel, select the loc
## Scoped ## Scoped
Localization supports scoped to prevent global impact. The syntax rule is `##<SCOPE ID>##<TEXT>`. Localization supports scoped to prevent global polluting. The syntax rules are as follows:
Scoped text is effective only when the ID of the ancestor element of the node matches the specified scope. - `##<SCOPE ID>##<TEXT>` Scoped text will only take effect when the ancestor element ID matches the specified scope.
- `##@<SELECTOR>##<TEXT>` Scoped text will only take effect when the ancestor element matches the specified CSS selector.
```json ```json
{ {
... ...
"##tab_ti##Normal": "正态", // only `Normal` under the element with id="tab_ti" 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 `Normal` under the element with id="tab_threedopenpose" 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模型`.
... ...
} }
``` ```

View File

@ -52,13 +52,15 @@ git clone https://github.com/journey-ad/sd-webui-bilingual-localization extensio
## スコープ ## スコープ
ローカライゼーションは、スコープ化されており、グローバルな影響を防止することができます。構文ルールは`##<SCOPE ID>##<TEXT>`です。 ローカリゼーションは、グローバルな影響を防ぐためにスコープを限定したサポートを提供します。構文規則は以下の通りです:
スコープを指定するIDが祖先要素のIDと一致する場合にのみ、スコープ化されたテキストが有効になります。 - `##<SCOPE ID>##<TEXT>` スコープが指定された要素の祖先のIDと一致する場合にのみ、スコープ付きのテキストが適用されます。
- `##@<SELECTOR>##<TEXT>` スコープが指定されたCSSセレクタと一致する場合にのみ、スコープ付きのテキストが適用されます。
```json ```json
... ...
"##tab_ti##Normal": "正常", // id="tab_ti"要素の下の`Normal`のみが`正常`として変換されます "##tab_ti##Normal": "正常", // id="tab_ti"の要素の下にある`Normal`のみが`正常`に変換されます
"##tab_threedopenpose##Normal": "法線マップ", // id="tab_threedopenpose"要素の下の`Normal`のみが `法線マップ`として変換されます "##tab_threedopenpose##Normal": "法線マップ", // id="tab_threedopenpose"の要素の下にある`Normal`のみが `法線マップ`に変換されます
"##@.extra-networks .tab-nav button##Lora": "Loraモデル", // class=".extra-networks .tab-nav button"の要素の下にある`Lora`のみが`Loraモデル`に変換されます
... ...
``` ```

View File

@ -48,14 +48,16 @@ git clone https://github.com/journey-ad/sd-webui-bilingual-localization extensio
## 作用域支持 ## 作用域支持
本地化语料支持限定作用域,防止影响全局翻译,语法规则`##<SCOPE ID>##<TEXT>` 本地化语料支持限定作用域,防止影响全局翻译,语法规则:
具有作用域的语料仅当节点祖先元素的ID匹配指定的作用域时才会生效 - `##<SCOPE ID>##<TEXT>` 仅当节点祖先元素ID匹配指定的作用域时才会生效
- `##@<SELECTOR>##<TEXT>` 仅当节点祖先元素匹配指定的CSS选择器时才会生效
```json ```json
{ {
... ...
"##tab_ti##Normal": "正态", // 仅id="tab_ti"元素下的`Normal`会被翻译为`正态` "##tab_ti##Normal": "正态", // 仅id="tab_ti"元素下的`Normal`会被翻译为`正态`
"##tab_threedopenpose##Normal": "法线图", // 仅id="tab_threedopenpose"元素下的`Normal`会被翻译为`法线图` "##tab_threedopenpose##Normal": "法线图", // 仅id="tab_threedopenpose"元素下的`Normal`会被翻译为`法线图`
"##@.extra-networks .tab-nav button##Lora": "Lora模型", // 仅class=".extra-networks .tab-nav button"元素下的`Lora`会被翻译为`Lora模型`
... ...
} }
``` ```