* Aspect ratios now show aspect ratios.
* Added style search.
* Added style sorting/ordering/favorites.
This commit is contained in:
lllyasviel
2023-11-14 14:06:12 -08:00
committed by GitHub
parent 375b30f375
commit cec0c2a8df
9 changed files with 147 additions and 15 deletions
+7 -6
View File
@@ -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):