修复客户端切换语言时,后台服务没有切换

This commit is contained in:
lzy
2023-10-25 11:12:37 +08:00
parent b6d9f84551
commit 0994138d10
2 changed files with 4 additions and 1 deletions

View File

@@ -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();
}

View File

@@ -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))) {