diff --git a/src/i18n/resources/en.json b/src/i18n/resources/en.json index d0c77234..a5966a8d 100644 --- a/src/i18n/resources/en.json +++ b/src/i18n/resources/en.json @@ -683,6 +683,42 @@ "refetch-btn": { "normal": "Refetch lyrics", "fetching": "Fetching..." + }, + "menu": { + "precise-timing": { + "label": "Make the lyrics perfectly synced", + "tooltip": "Calculate to the milisecond the display of the next line (can have a small impact on performance)" + }, + "line-effect": { + "label": "Line effect", + "tooltip": "Choose the effect to apply to the current line", + "submenu": { + "scale": { + "label": "Scale", + "tooltip": "Scale the current line" + }, + "offset": { + "label": "Offset", + "tooltip": "Offset on the right the current line" + }, + "focus": { + "label": "Focus", + "tooltip": "Make only the current line white" + } + } + }, + "default-text-string": { + "label": "Default character between lyrics", + "tooltip": "Choose the default character to use for the gap between lyrics" + }, + "show-time-codes": { + "label": "Show time codes", + "tooltip": "Show the time codes next to the lyrics" + }, + "show-lyrics-even-if-inexact": { + "label": "Show lyrics even if inexact", + "tooltip": "If the song is not found, the plugin tries again with a different search query.\nThe result from the second attempt may not be exact." + } } }, "taskbar-mediacontrol": { diff --git a/src/plugins/synced-lyrics/index.ts b/src/plugins/synced-lyrics/index.ts index e086c4d4..c490631b 100644 --- a/src/plugins/synced-lyrics/index.ts +++ b/src/plugins/synced-lyrics/index.ts @@ -1,12 +1,11 @@ import style from './style.css?inline'; import { createPlugin } from '@/utils'; - -import { SyncedLyricsPluginConfig } from './types'; +import { t } from '@/i18n'; import { menu } from './menu'; import { renderer } from './renderer'; -import { t } from '@/i18n'; +import type { SyncedLyricsPluginConfig } from './types'; export default createPlugin({ name: () => t('plugins.synced-lyrics.name'), @@ -15,12 +14,13 @@ export default createPlugin({ restartNeeded: true, addedVersion: '3.5.X', config: { + enabled: false, preciseTiming: true, showLyricsEvenIfInexact: true, showTimeCodes: false, defaultTextString: '♪', lineEffect: 'scale', - } as SyncedLyricsPluginConfig, + } satisfies SyncedLyricsPluginConfig, menu, renderer, diff --git a/src/plugins/synced-lyrics/menu.ts b/src/plugins/synced-lyrics/menu.ts index ac91ad05..a8e59c94 100644 --- a/src/plugins/synced-lyrics/menu.ts +++ b/src/plugins/synced-lyrics/menu.ts @@ -1,7 +1,9 @@ import { MenuItemConstructorOptions } from 'electron'; -import { MenuContext } from '@/types/contexts'; -import { SyncedLyricsPluginConfig } from './types'; +import { t } from '@/i18n'; + +import type { MenuContext } from '@/types/contexts'; +import type { SyncedLyricsPluginConfig } from './types'; export const menu = async ({ getConfig, @@ -13,9 +15,8 @@ export const menu = async ({ return [ { - label: 'Make the lyrics perfectly synced', - toolTip: - 'Calculate to the milisecond the display of the next line (can have a small impact on performance)', + label: t('plugins.synced-lyrics.menu.precise-timing.label'), + toolTip: t('plugins.synced-lyrics.menu.precise-timing.tooltip'), type: 'checkbox', checked: config.preciseTiming, click(item) { @@ -25,13 +26,13 @@ export const menu = async ({ }, }, { - label: 'Line effect', - toolTip: 'Choose the effect to apply to the current line', + label: t('plugins.synced-lyrics.menu.line-effect.label'), + toolTip: t('plugins.synced-lyrics.menu.line-effect.tooltip'), type: 'submenu', submenu: [ { - label: 'Scale', - toolTip: 'Scale the current line', + label: t('plugins.synced-lyrics.menu.line-effect.submenu.scale.label'), + toolTip: t('plugins.synced-lyrics.menu.line-effect.submenu.scale.tooltip'), type: 'radio', checked: config.lineEffect === 'scale', click() { @@ -41,8 +42,8 @@ export const menu = async ({ }, }, { - label: 'Offset', - toolTip: 'Offset on the right the current line', + label: t('plugins.synced-lyrics.menu.line-effect.submenu.offset.label'), + toolTip: t('plugins.synced-lyrics.menu.line-effect.submenu.offset.tooltip'), type: 'radio', checked: config.lineEffect === 'offset', click() { @@ -52,8 +53,8 @@ export const menu = async ({ }, }, { - label: 'Focus', - toolTip: 'Make only the current line white', + label: t('plugins.synced-lyrics.menu.line-effect.submenu.focus.label'), + toolTip: t('plugins.synced-lyrics.menu.line-effect.submenu.focus.tooltip'), type: 'radio', checked: config.lineEffect === 'focus', click() { @@ -65,8 +66,8 @@ export const menu = async ({ ], }, { - label: 'Default character between lyrics', - toolTip: 'Choose the default string to use for the gap between lyrics', + label: t('plugins.synced-lyrics.menu.default-text-string.label'), + toolTip: t('plugins.synced-lyrics.menu.default-text-string.tooltip'), type: 'submenu', submenu: [ { @@ -80,7 +81,7 @@ export const menu = async ({ }, }, { - label: '[SPACE]', + label: '" "', type: 'radio', checked: config.defaultTextString === ' ', click() { @@ -112,8 +113,8 @@ export const menu = async ({ ], }, { - label: 'Show time codes', - toolTip: 'Show the time codes next to the lyrics', + label: t('plugins.synced-lyrics.menu.show-time-codes.label'), + toolTip: t('plugins.synced-lyrics.menu.show-time-codes.tooltip'), type: 'checkbox', checked: config.showTimeCodes, click(item) { @@ -123,9 +124,8 @@ export const menu = async ({ }, }, { - label: 'Show lyrics even if inexact', - toolTip: - 'If the song is not found, the plugin tries again with a different search query.\nThe result from the second attempt may not be exact.', + label: t('plugins.synced-lyrics.menu.show-lyrics-even-if-inexact.label'), + toolTip: t('plugins.synced-lyrics.menu.show-lyrics-even-if-inexact.tooltip'), type: 'checkbox', checked: config.showLyricsEvenIfInexact, click(item) { diff --git a/src/plugins/synced-lyrics/renderer/components/LyricsContainer.tsx b/src/plugins/synced-lyrics/renderer/components/LyricsContainer.tsx index b97704d1..e48f90e4 100644 --- a/src/plugins/synced-lyrics/renderer/components/LyricsContainer.tsx +++ b/src/plugins/synced-lyrics/renderer/components/LyricsContainer.tsx @@ -5,7 +5,6 @@ import { SyncedLine } from './SyncedLine'; import { t } from '@/i18n'; import { getSongInfo } from '@/providers/song-info-front'; -import { LineLyrics } from '../../types'; import { differentDuration, hadSecondAttempt, @@ -14,6 +13,8 @@ import { makeLyricsRequest, } from '../lyrics/fetch'; +import type { LineLyrics } from '../../types'; + export const [debugInfo, setDebugInfo] = createSignal(); export const [lineLyrics, setLineLyrics] = createSignal([]); export const [currentTime, setCurrentTime] = createSignal(-1); diff --git a/src/plugins/synced-lyrics/renderer/lyrics/fetch.ts b/src/plugins/synced-lyrics/renderer/lyrics/fetch.ts index 5f281da1..1c65548a 100644 --- a/src/plugins/synced-lyrics/renderer/lyrics/fetch.ts +++ b/src/plugins/synced-lyrics/renderer/lyrics/fetch.ts @@ -1,12 +1,13 @@ import { createSignal } from 'solid-js'; import { jaroWinkler } from '@skyra/jaro-winkler'; -import { SongInfo } from '@/providers/song-info'; - -import { LineLyrics, LRCLIBSearchResponse } from '../../types'; import { config } from '../renderer'; + import { setDebugInfo, setLineLyrics } from '../components/LyricsContainer'; +import type { SongInfo } from '@/providers/song-info'; +import type { LineLyrics, LRCLIBSearchResponse } from '../../types'; + // prettier-ignore export const [isInstrumental, setIsInstrumental] = createSignal(false); // prettier-ignore diff --git a/src/plugins/synced-lyrics/renderer/renderer.tsx b/src/plugins/synced-lyrics/renderer/renderer.tsx index 60f027bd..d1edd134 100644 --- a/src/plugins/synced-lyrics/renderer/renderer.tsx +++ b/src/plugins/synced-lyrics/renderer/renderer.tsx @@ -1,10 +1,9 @@ import { createSignal, Show } from 'solid-js'; -import { VideoDetails } from '@/types/video-details'; - import { LyricsContainer } from './components/LyricsContainer'; -import { SyncedLyricsPluginConfig } from '../types'; +import type { VideoDetails } from '@/types/video-details'; +import type { SyncedLyricsPluginConfig } from '../types'; export const [isVisible, setIsVisible] = createSignal(false); diff --git a/src/plugins/synced-lyrics/renderer/utils.tsx b/src/plugins/synced-lyrics/renderer/utils.tsx index ce916be4..2142f32e 100644 --- a/src/plugins/synced-lyrics/renderer/utils.tsx +++ b/src/plugins/synced-lyrics/renderer/utils.tsx @@ -1,7 +1,8 @@ import { render } from 'solid-js/web'; import { LyricsRenderer, setIsVisible, setPlayerState } from './renderer'; -import { VideoDetails } from '@/types/video-details'; + +import type { VideoDetails } from '@/types/video-details'; export const selectors = { head: '#tabsContent > .tab-header:nth-of-type(2)',