diff --git a/chat2db-client/src/blocks/Setting/BaseSetting/index.tsx b/chat2db-client/src/blocks/Setting/BaseSetting/index.tsx index aa4ff38e..bb2c1547 100644 --- a/chat2db-client/src/blocks/Setting/BaseSetting/index.tsx +++ b/chat2db-client/src/blocks/Setting/BaseSetting/index.tsx @@ -105,6 +105,9 @@ export default function BaseSetting() { function changeLang(e: any) { setLangLocalStorage(e.target.value); + //切换语言时,需要设置cookie,用来改变后台服务的Locale + const date = new Date('2030-12-30 12:30:00').toUTCString(); + document.cookie = `CHAT2DB.LOCALE=${e.target.value};Expires=${date}`; location.reload(); } diff --git a/chat2db-server/chat2db-server-start/src/main/java/ai/chat2db/server/start/config/util/CopyTemplate.java b/chat2db-server/chat2db-server-start/src/main/java/ai/chat2db/server/start/config/util/CopyTemplate.java index b0f6c164..54364db3 100644 --- a/chat2db-server/chat2db-server-start/src/main/java/ai/chat2db/server/start/config/util/CopyTemplate.java +++ b/chat2db-server/chat2db-server-start/src/main/java/ai/chat2db/server/start/config/util/CopyTemplate.java @@ -49,7 +49,7 @@ public class CopyTemplate { try (// 模板文件输入输出地址 读取resources下文件 FileOutputStream outputStream = new FileOutputStream(dir + File.separator + path); //返回读取指定资源的输入流 - InputStream inputStream = ConfigUtils.class.getClassLoader().getResourceAsStream("template" + File.separator + path)) { + InputStream inputStream = CopyTemplate.class.getClassLoader().getResourceAsStream("template/" + path)) { byte[] buffer = new byte[4096]; int n = 0; while (-1 != (n = inputStream.read(buffer))) {