mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
feat: add support i18n (#1468)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { createPlugin } from '@/utils';
|
||||
import { onMainLoad } from './main';
|
||||
import { onMenu } from './menu';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export type ShortcutMappingType = {
|
||||
previous: string;
|
||||
@ -15,9 +16,8 @@ export type ShortcutsPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: 'Shortcuts (& MPRIS)',
|
||||
description:
|
||||
'Allows setting global hotkeys for playback (play/pause/next/previous) + disable media osd by overriding media keys + enable Ctrl/CMD + F to search + enable linux mpris support for mediakeys + custom hotkeys for advanced users',
|
||||
name: t('plugins.shortcuts.name'),
|
||||
description: t('plugins.shortcuts.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -2,6 +2,8 @@ import prompt, { KeybindOptions } from 'custom-electron-prompt';
|
||||
|
||||
import promptOptions from '@/providers/prompt-options';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import type { ShortcutsPluginConfig } from './index';
|
||||
import type { BrowserWindow } from 'electron';
|
||||
import type { MenuContext } from '@/types/contexts';
|
||||
@ -29,14 +31,14 @@ export const onMenu = async ({
|
||||
) {
|
||||
const output = await prompt(
|
||||
{
|
||||
title: 'Global Keybinds',
|
||||
label: 'Choose Global Keybinds for Songs Control:',
|
||||
title: t('plugins.shortcuts.prompt.keybind.title'),
|
||||
label: t('plugins.shortcuts.prompt.keybind.label'),
|
||||
type: 'keybind',
|
||||
keybindOptions: [
|
||||
// If default=undefined then no default is used
|
||||
kb('Previous', 'previous', config.global?.previous),
|
||||
kb('Play / Pause', 'playPause', config.global?.playPause),
|
||||
kb('Next', 'next', config.global?.next),
|
||||
kb(t('plugins.shortcuts.prompt.keybind.keybind-options.previous'), 'previous', config.global?.previous),
|
||||
kb(t('plugins.shortcuts.prompt.keybind.keybind-options.play-pause'), 'playPause', config.global?.playPause),
|
||||
kb(t('plugins.shortcuts.prompt.keybind.keybind-options.next'), 'next', config.global?.next),
|
||||
],
|
||||
height: 270,
|
||||
...promptOptions(),
|
||||
@ -59,11 +61,11 @@ export const onMenu = async ({
|
||||
|
||||
return [
|
||||
{
|
||||
label: 'Set Global Song Controls',
|
||||
label: t('plugins.shortcuts.menu.set-keybinds'),
|
||||
click: () => promptKeybind(config, window),
|
||||
},
|
||||
{
|
||||
label: 'Override MediaKeys',
|
||||
label: t('plugins.shortcuts.menu.override-media-keys'),
|
||||
type: 'checkbox',
|
||||
checked: config.overrideMediaKeys,
|
||||
click: (item) => setConfig({ overrideMediaKeys: item.checked }),
|
||||
|
||||
Reference in New Issue
Block a user