mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
2.1.808
* Aspect ratios now show aspect ratios. * Added style search. * Added style sorting/ordering/favorites.
This commit is contained in:
@@ -2,29 +2,30 @@ import json
|
||||
import os
|
||||
|
||||
|
||||
current_translation = {}
|
||||
localization_root = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'language')
|
||||
|
||||
|
||||
def localization_js(filename):
|
||||
data = {}
|
||||
global current_translation
|
||||
|
||||
if isinstance(filename, str):
|
||||
full_name = os.path.abspath(os.path.join(localization_root, filename + '.json'))
|
||||
if os.path.exists(full_name):
|
||||
try:
|
||||
with open(full_name, encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
assert isinstance(data, dict)
|
||||
for k, v in data.items():
|
||||
current_translation = json.load(f)
|
||||
assert isinstance(current_translation, dict)
|
||||
for k, v in current_translation.items():
|
||||
assert isinstance(k, str)
|
||||
assert isinstance(v, str)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
print(f'Failed to load localization file {full_name}')
|
||||
|
||||
# data = {k: 'XXX' for k in data.keys()} # use this to see if all texts are covered
|
||||
# current_translation = {k: 'XXX' for k in current_translation.keys()} # use this to see if all texts are covered
|
||||
|
||||
return f"window.localization = {json.dumps(data)}"
|
||||
return f"window.localization = {json.dumps(current_translation)}"
|
||||
|
||||
|
||||
def dump_english_config(components):
|
||||
|
||||
Reference in New Issue
Block a user