diff options
author | Aarni Koskela <akx@iki.fi> | 2023-05-13 16:14:10 +0000 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2023-05-13 16:15:13 +0000 |
commit | 1f57b948b78df872c5a8a1c6e6c7e3c35e06f969 (patch) | |
tree | 222d79ff2b489ff51654ef2c826fc42df344745c /modules/ui.py | |
parent | 999a03e4a770217395b5eb8f8165ed0d8ebe5656 (diff) | |
download | stable-diffusion-webui-gfx803-1f57b948b78df872c5a8a1c6e6c7e3c35e06f969.tar.gz stable-diffusion-webui-gfx803-1f57b948b78df872c5a8a1c6e6c7e3c35e06f969.tar.bz2 stable-diffusion-webui-gfx803-1f57b948b78df872c5a8a1c6e6c7e3c35e06f969.zip |
Move localization to its own script block and load it first
Diffstat (limited to 'modules/ui.py')
-rw-r--r-- | modules/ui.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/ui.py b/modules/ui.py index ff82fff6..ff25c4ce 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1771,12 +1771,11 @@ def webpath(fn): def javascript_html():
- script_js = os.path.join(script_path, "script.js")
- head = f'<script type="text/javascript" src="{webpath(script_js)}"></script>\n'
+ # Ensure localization is in `window` before scripts
+ head = f'<script type="text/javascript">{localization.localization_js(shared.opts.localization)}</script>\n'
- inline = f"{localization.localization_js(shared.opts.localization)};"
- if cmd_opts.theme is not None:
- inline += f"set_theme('{cmd_opts.theme}');"
+ script_js = os.path.join(script_path, "script.js")
+ head += f'<script type="text/javascript" src="{webpath(script_js)}"></script>\n'
for script in modules.scripts.list_scripts("javascript", ".js"):
head += f'<script type="text/javascript" src="{webpath(script.path)}"></script>\n'
@@ -1784,7 +1783,8 @@ def javascript_html(): for script in modules.scripts.list_scripts("javascript", ".mjs"):
head += f'<script type="module" src="{webpath(script.path)}"></script>\n'
- head += f'<script type="text/javascript">{inline}</script>\n'
+ if cmd_opts.theme:
+ head += f'<script type="text/javascript">set_theme(\"{cmd_opts.theme}\");</script>\n'
return head
|