electron menu translation WIP

This commit is contained in:
SPRINX0\prochazka
2025-11-18 09:20:56 +01:00
parent 6e439adb51
commit 7bb9414be8
4 changed files with 35 additions and 7 deletions

View File

@@ -27,7 +27,7 @@
import SettingsListener from './utility/SettingsListener.svelte';
import { handleAuthOnStartup } from './clientAuth';
import { initializeAppUpdates } from './utility/appUpdate';
import { _t, saveSelectedLanguageToCache } from './translations';
import { _t, getCurrentTranslations, saveSelectedLanguageToCache } from './translations';
import { installCloudListeners } from './utility/cloudListeners';
export let isAdminPage = false;
@@ -62,6 +62,11 @@
installCloudListeners();
refreshPublicCloudFiles();
saveSelectedLanguageToCache();
const electron = getElectron();
if (electron) {
electron.send('translation-data', JSON.stringify(getCurrentTranslations()));
}
}
loadedApi = loadedApiValue;

View File

@@ -58,6 +58,11 @@ function getTranslation(key: string, defaultMessage: string, language: string) {
return translation;
}
export function getCurrentTranslations(): Record<string, string> {
const selectedLanguage = getSelectedLanguage();
return translations[selectedLanguage] || {};
}
export function _t(key: string, options: TranslateOptions): string {
const { defaultMessage, values } = options;