新增 pc-client:畅联 PC 端工程(Electron+React,按确认效果图改造,B-59)
- 基于 openim-electron-demo 改造:工号+密码登录(自研账号服务)、会话列表/聊天窗/通讯录界面重做
- 文字/语音/文件/图片消息、文件拖拽发送、表情面板、一对一语音通话(LiveKit)
- RTC 令牌对接账号服务带鉴权版 /api/rtc_token(Bearer imToken + {room,identity})
- account-service: CORS Allow-Headers 补 authorization(浏览器/渲染进程跨域调 rtc_token 需要)
- 附本地 mock 账号服务(scripts/mock-account-server.js)与截图联调脚本
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import i18n from "i18next";
|
||||
|
||||
import { getStore } from "../main/storeManage";
|
||||
import { app } from "electron";
|
||||
|
||||
import translation_en from "./resources/en-US";
|
||||
import translation_zh from "./resources/zh-CN";
|
||||
|
||||
const store = getStore();
|
||||
|
||||
export const initI18n = () => {
|
||||
const systemLanguage = app.getLocale();
|
||||
const language = store.get("language", systemLanguage) as string;
|
||||
|
||||
const resources = {
|
||||
"en-US": {
|
||||
translation: translation_en,
|
||||
},
|
||||
"zh-CN": {
|
||||
translation: translation_zh,
|
||||
},
|
||||
zh: {
|
||||
translation: translation_zh,
|
||||
},
|
||||
};
|
||||
|
||||
i18n.init(
|
||||
{
|
||||
resources,
|
||||
lng: language,
|
||||
fallbackLng: "zh-CN",
|
||||
},
|
||||
(err) => {
|
||||
if (err) return console.error("Error loading i18n resources:", err);
|
||||
console.log("i18n resources loaded successfully");
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const changeLanguage = i18n.changeLanguage;
|
||||
Reference in New Issue
Block a user