mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +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;
|
return global.TRANSLATION_DATA?.[key] || defaultMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
if (electron) {
|
if (electron) {
|
||||||
electron.send('translation-data', JSON.stringify(getCurrentTranslations()));
|
electron.send('translation-data', JSON.stringify(getCurrentTranslations()));
|
||||||
|
global.TRANSLATION_DATA = getCurrentTranslations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { commandsCustomized, currentDropDownMenu } from '../stores';
|
import { commandsCustomized, currentDropDownMenu } from '../stores';
|
||||||
import { prepareMenuItems } from '../utility/contextMenu';
|
import { prepareMenuItems } from '../utility/contextMenu';
|
||||||
import DropDownMenu from './DropDownMenu.svelte';
|
|
||||||
import { _t } from '../translations';
|
|
||||||
|
|
||||||
export let items;
|
export let items;
|
||||||
|
|
||||||
@@ -38,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.text || _t(item.label.id, item.label.defaultMessage)}
|
{item.text || item.label}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export function getCurrentTranslations(): Record<string, string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function _t(key: string, options: TranslateOptions): string {
|
export function _t(key: string, options: TranslateOptions): string {
|
||||||
const { defaultMessage, values } = options;
|
const { defaultMessage, values } = options || {};
|
||||||
|
|
||||||
const selectedLanguage = getSelectedLanguage();
|
const selectedLanguage = getSelectedLanguage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user