Files
sd-webui-prompt-all-in-one/scripts/get_i18n.py
Physton fa091e3dc1 Created
Former-commit-id: e255ced1c91ef6a7722dce7268872be9ee326168
2023-05-08 20:35:02 +08:00

15 lines
410 B
Python

import os
import json
i18n = {}
def get_i18n(reload=False):
global i18n
if reload or not i18n:
i18n = {}
current_dir = os.path.dirname(os.path.abspath(__file__))
config_file = os.path.join(current_dir, '../i18n.json')
config_file = os.path.normpath(config_file)
with open(config_file, 'r', encoding='utf8') as f:
i18n = json.load(f)
return i18n