Localize the renderer UI into Chinese behind the language setting
This commit is contained in:
1 parent
d404e1e72a
commit
3e4c7c81a2
58 files changed
+1176
-597
No files matched your search
@@ -6,6 +6,8 @@ export interface CreateWindowOptions {
|
||||
preloadPath: string;
|
||||
rendererDist: string;
|
||||
devServerUrl?: string;
|
||||
/** UI language for renderer strings; injected synchronously via argv. */
|
||||
language: string;
|
||||
}
|
||||
|
||||
export function createMainWindow(options: CreateWindowOptions): BrowserWindow {
|
||||
@@ -27,6 +29,7 @@ export function createMainWindow(options: CreateWindowOptions): BrowserWindow {
|
||||
sandbox: true,
|
||||
webSecurity: true,
|
||||
allowRunningInsecureContent: false,
|
||||
additionalArguments: [`--app-language=${options.language}`],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+3
-1
@@ -23,7 +23,8 @@ if (!app.requestSingleInstanceLock()) {
|
||||
// strings, date formatting) is only settable pre-ready, and it follows the
|
||||
// stored language preference instead of the OS locale.
|
||||
const connection = new DatabaseConnection(join(profileDir, "agentcompany.db"));
|
||||
app.commandLine.appendSwitch("lang", storedLanguage(connection.db) === "zh" ? "zh-CN" : "en-US");
|
||||
const language = storedLanguage(connection.db);
|
||||
app.commandLine.appendSwitch("lang", language === "zh" ? "zh-CN" : "en-US");
|
||||
|
||||
app.whenReady().then(() => {
|
||||
connection.transaction(() => recoverInterruptedWork(connection.db));
|
||||
@@ -31,6 +32,7 @@ if (!app.requestSingleInstanceLock()) {
|
||||
preloadPath: join(__dirname, "../preload/index.js"),
|
||||
rendererDist: join(__dirname, "../renderer"),
|
||||
devServerUrl: process.env.ELECTRON_RENDERER_URL,
|
||||
language,
|
||||
});
|
||||
|
||||
registerIpcHandlers({
|
||||
|
||||
Reference in new issue
Block a user