Files
Physton 510fa649c6 Optimize Python code
Former-commit-id: 8d08367816ff84a2a2f62470b06421c0340f5fdb
2023-06-15 17:21:56 +08:00

17 lines
415 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