feat: 添加i18n_getmsgs端点(无扩展名)

This commit is contained in:
yumoqing 2026-06-12 00:28:33 +08:00
parent 66bd5a2888
commit 136e7a7e57

17
wwwroot/i18n_getmsgs Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
"""i18n messages endpoint for bricks framework"""
import json
import os
lang = params_kw.get('lang', 'zh-CN')
i18n_name = params_kw.get('i18n', 'i18n')
msgs = {}
i18n_dir = os.path.join(os.path.dirname(__file__), 'i18n', lang)
i18n_file = os.path.join(i18n_dir, f'{i18n_name}.json')
if os.path.exists(i18n_file):
with open(i18n_file, 'r', encoding='utf-8') as f:
msgs = json.load(f)
return json.dumps({"success": True, "msgs": msgs}, ensure_ascii=False)