mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
horizontal menu translation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
function _t(key, { defaultMessage }) {
|
||||
function _t(key, { defaultMessage } = {}) {
|
||||
return global.TRANSLATION_DATA?.[key] || defaultMessage;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
const electron = getElectron();
|
||||
if (electron) {
|
||||
electron.send('translation-data', JSON.stringify(getCurrentTranslations()));
|
||||
global.TRANSLATION_DATA = getCurrentTranslations();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user