mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-25 00:31:43 +08:00
feat(options): restart when setting locale
This commit is contained in:
parent
a5a7a30cd5
commit
ab58671625
@ -10,6 +10,17 @@ function reloadFrontendApp(reason?: string) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function restartDesktopApp() {
|
||||
if (!isElectron()) {
|
||||
reloadFrontendApp();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = dynamicRequire("@electron/remote").app;
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers the system tray to update its menu items, i.e. after a change in dynamic content such as bookmarks or recent notes.
|
||||
*
|
||||
@ -739,6 +750,7 @@ function isLaunchBarConfig(noteId: string) {
|
||||
|
||||
export default {
|
||||
reloadFrontendApp,
|
||||
restartDesktopApp,
|
||||
reloadTray,
|
||||
parseDate,
|
||||
getMonthsInDateRange,
|
||||
|
||||
@ -61,11 +61,7 @@ export default class ElectronIntegrationOptions extends OptionsWidget {
|
||||
this.$backgroundEffects.on("change", () => this.updateCheckboxOption("backgroundEffects", this.$backgroundEffects));
|
||||
|
||||
const restartAppButton = this.$widget.find(".restart-app-button");
|
||||
restartAppButton.on("click", () => {
|
||||
const app = utils.dynamicRequire("@electron/remote").app;
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
restartAppButton.on("click", utils.restartDesktopApp);
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
|
||||
@ -59,6 +59,7 @@ export default class LocalizationOptions extends OptionsWidget {
|
||||
this.$formattingLocaleSelect.on("change", async () => {
|
||||
const newLocale = this.$formattingLocaleSelect.val();
|
||||
await server.put(`options/formattingLocale/${newLocale}`);
|
||||
utils.restartDesktopApp();
|
||||
});
|
||||
|
||||
this.$widget.find(`input[name="first-day-of-week"]`).on("change", () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user