Support app.setLocale() or --lang switch #591

Closed
opened 2026-01-29 16:43:35 +00:00 by claunia · 1 comment
Owner

Originally created by @lukasportal on GitHub (Nov 4, 2020).

I want to manually set the locale of the app, instead of using the default one.

From here, we can see that the electron team have added app.setLocale() successfully
https://github.com/electron/electron/pull/26185

A quick workaround could be adding the switch --lang=XYZ on chromium launch.

How possible would it be to add support for any of these 2? Or is there an existing workaround for this?

Originally created by @lukasportal on GitHub (Nov 4, 2020). I want to manually set the locale of the app, instead of using the default one. From here, we can see that the electron team have added `app.setLocale()` successfully https://github.com/electron/electron/pull/26185 A quick workaround could be adding the switch `--lang=XYZ` on chromium launch. How possible would it be to add support for any of these 2? Or is there an existing workaround for this?
claunia added the Feature label 2026-01-29 16:43:35 +00:00
Author
Owner

@danatcofo commented on GitHub (Jan 25, 2021):

You can use the HostHook feature to do this as well. It runs in the main thread and has access to the App module.

index.ts

export class HookService extends Connector {
    constructor(socket: SocketIO.Socket, public app: Electron.App) {
        super(socket, app);
    }

    onHostReady(): void {
        this.app.setLocale('locale');
    }
}
@danatcofo commented on GitHub (Jan 25, 2021): You can use the HostHook feature to do this as well. It runs in the main thread and has access to the App module. **index.ts** ```typescript export class HookService extends Connector { constructor(socket: SocketIO.Socket, public app: Electron.App) { super(socket, app); } onHostReady(): void { this.app.setLocale('locale'); } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#591