Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
0c1c9e74
Commit
0c1c9e74
authored
Sep 05, 2023
by
liubo0902
Committed by
GitHub
Sep 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update localization.py
parent
5ef669de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
modules/localization.py
modules/localization.py
+16
-10
No files found.
modules/localization.py
View file @
0c1c9e74
import
json
import
os
from
modules
import
errors
,
scripts
from
modules
import
errors
localizations
=
{}
...
...
@@ -14,21 +14,27 @@ def list_localizations(dirname):
if
ext
.
lower
()
!=
".json"
:
continue
localizations
[
fn
]
=
os
.
path
.
join
(
dirname
,
file
)
fn
=
fn
.
replace
(
" "
,
""
)
.
replace
(
"("
,
"_"
)
.
replace
(
")"
,
""
)
localizations
[
fn
]
=
[
os
.
path
.
join
(
dirname
,
file
)]
from
modules
import
scripts
for
file
in
scripts
.
list_scripts
(
"localizations"
,
".json"
):
fn
,
ext
=
os
.
path
.
splitext
(
file
.
filename
)
localizations
[
fn
]
=
file
.
path
fn
=
fn
.
replace
(
" "
,
""
)
.
replace
(
"("
,
"_"
)
.
replace
(
")"
,
""
)
if
fn
not
in
localizations
:
localizations
[
fn
]
=
[]
localizations
[
fn
]
.
append
(
file
.
path
)
def
localization_js
(
current_localization_name
:
str
)
->
str
:
fn
=
localizations
.
get
(
current_localization_name
,
None
)
fn
s
=
localizations
.
get
(
current_localization_name
,
None
)
data
=
{}
if
fn
is
not
None
:
try
:
with
open
(
fn
,
"r"
,
encoding
=
"utf8"
)
as
file
:
data
=
json
.
load
(
file
)
except
Exception
:
errors
.
report
(
f
"Error loading localization from {fn}"
,
exc_info
=
True
)
if
fns
is
not
None
:
for
fn
in
fns
:
try
:
with
open
(
fn
,
"r"
,
encoding
=
"utf8"
)
as
file
:
data
.
update
(
json
.
load
(
file
))
except
Exception
:
errors
.
report
(
f
"Error loading localization from {fn}"
,
exc_info
=
True
)
return
f
"window.localization = {json.dumps(data)}"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment