From 136e7a7e5716fbd5921343471d8f53b4b34ddcaa Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 12 Jun 2026 00:28:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0i18n=5Fgetmsgs?= =?UTF-8?q?=E7=AB=AF=E7=82=B9=EF=BC=88=E6=97=A0=E6=89=A9=E5=B1=95=E5=90=8D?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/i18n_getmsgs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 wwwroot/i18n_getmsgs diff --git a/wwwroot/i18n_getmsgs b/wwwroot/i18n_getmsgs new file mode 100644 index 0000000..46ccf78 --- /dev/null +++ b/wwwroot/i18n_getmsgs @@ -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)