mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
fix: update i18n in updateUserPreferences and in hydra startup
This commit is contained in:
parent
77152a32ab
commit
8a5d4e38b6
@ -2,17 +2,23 @@ import { userPreferencesRepository } from "@main/repository";
|
|||||||
import { registerEvent } from "../register-event";
|
import { registerEvent } from "../register-event";
|
||||||
|
|
||||||
import type { UserPreferences } from "@types";
|
import type { UserPreferences } from "@types";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
const updateUserPreferences = async (
|
const updateUserPreferences = async (
|
||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
preferences: Partial<UserPreferences>
|
preferences: Partial<UserPreferences>
|
||||||
) =>
|
) => {
|
||||||
userPreferencesRepository.upsert(
|
if (preferences.language) {
|
||||||
|
i18next.changeLanguage(preferences.language);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userPreferencesRepository.upsert(
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
...preferences,
|
...preferences,
|
||||||
},
|
},
|
||||||
["id"]
|
["id"]
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
registerEvent("updateUserPreferences", updateUserPreferences);
|
registerEvent("updateUserPreferences", updateUserPreferences);
|
||||||
|
@ -72,6 +72,10 @@ app.whenReady().then(async () => {
|
|||||||
where: { id: 1 },
|
where: { id: 1 },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (userPreferences?.language) {
|
||||||
|
i18n.changeLanguage(userPreferences.language);
|
||||||
|
}
|
||||||
|
|
||||||
WindowManager.createMainWindow();
|
WindowManager.createMainWindow();
|
||||||
WindowManager.createSystemTray(userPreferences?.language || "en");
|
WindowManager.createSystemTray(userPreferences?.language || "en");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user