| [中文文档](README_ZH.md) / [日本語](README_JA.md) | |
| <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 | |
| [Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) bilingual localization extensions. | |
|  | |
| ## Features | |
| - Bilingual translation, no need to worry about how to find the original button. | |
| - Compatible with language pack extensions, no need to re-import. | |
| - Support dynamic translation of title hints. | |
| - Additional support Scoped and RegExp pattern, more flexible translation. | |
| ## Installation | |
| Choose one of the following methods, Need to use webui with extension support <sup>(Versions after 2023)</sup> | |
| #### Method 1 | |
| Use the `Install from URL` provided by webui to install | |
| Click in order <kbd>Extensions</kbd> - <kbd>Install from URL</kbd> | |
| Then fill in the first text box with `https://github.com/journey-ad/sd-webui-bilingual-localization`, click the <kbd>Install</kbd> button. | |
|  | |
| After that, switch to the <kbd>Installed</kbd> panel and click the <kbd>Apply and restart UI</kbd> button. | |
|  | |
| #### Method 2 | |
| Clone to your extension directory manually. | |
| ```bash | |
| git clone https://github.com/journey-ad/sd-webui-bilingual-localization extensions/sd-webui-bilingual-localization | |
| ``` | |
| ## Usage | |
| > **⚠️Important⚠️** | |
| > Make sure <kbd>Settings</kbd> - <kbd>User interface</kbd> - <kbd>Localization</kbd> is set to `None` | |
| In <kbd>Settings</kbd> - <kbd>Bilingual Localization</kbd> panel, select the localization file you want to enable and click on the <kbd>Apply settings</kbd> and <kbd>Reload UI</kbd> buttons in turn. | |
|  | |
| ## Scoped | |
| Localization supports scoped to prevent global impact. The syntax rule is `##<SCOPE ID>##<TEXT>`. | |
| Scoped text is effective only when the ID of the ancestor element of the node matches the specified scope. | |
| ```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 `法线图`. | |
| ... | |
| } | |
| ``` | |
| ## RegExp pattern | |
| Localization support RegExp pattern, syntax rule is `@@<REGEXP>`, capturing group is `$n`, doc: [String.prototype.replace()](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/replace) | |
| ```json | |
| { | |
| ... | |
| "@@/^(\\d+) images in this directory, divided into (\\d+) pages$/": "目录中有$1张图片,共$2页", | |
| "@@/^Favorites path from settings: (.*)$/": "设置的收藏夹目录:$1", | |
| ... | |
| } | |
| ``` | |
| ## How to get localization file | |
| Localization files are no longer provided with the plugin, please install a third-party language extensions and set-up as described in the [Usage](#usage) section of this article. | |