horizontal menu translation

This commit is contained in:
SPRINX0\prochazka
2025-11-18 10:14:36 +01:00
parent 8556974ef1
commit 9b60173b8c
4 changed files with 4 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
function _t(key, { defaultMessage }) {
function _t(key, { defaultMessage } = {}) {
return global.TRANSLATION_DATA?.[key] || defaultMessage;
}

View File

@@ -66,6 +66,7 @@
const electron = getElectron();
if (electron) {
electron.send('translation-data', JSON.stringify(getCurrentTranslations()));
global.TRANSLATION_DATA = getCurrentTranslations();
}
}

View File

@@ -1,8 +1,6 @@
<script lang="ts">
import { commandsCustomized, currentDropDownMenu } from '../stores';
import { prepareMenuItems } from '../utility/contextMenu';
import DropDownMenu from './DropDownMenu.svelte';
import { _t } from '../translations';
export let items;
@@ -38,7 +36,7 @@
}
}}
>
{item.text || _t(item.label.id, item.label.defaultMessage)}
{item.text || item.label}
</div>
{/each}
</div>

View File

@@ -64,7 +64,7 @@ export function getCurrentTranslations(): Record<string, string> {
}
export function _t(key: string, options: TranslateOptions): string {
const { defaultMessage, values } = options;
const { defaultMessage, values } = options || {};
const selectedLanguage = getSelectedLanguage();