fix(synced-lyrics): fix i18n

This commit is contained in:
JellyBrick
2024-08-01 19:56:32 +09:00
parent 482a1c5073
commit 8750b54f76
7 changed files with 71 additions and 33 deletions

View File

@ -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": {

View File

@ -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,

View File

@ -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) {

View File

@ -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<string>();
export const [lineLyrics, setLineLyrics] = createSignal<LineLyrics[]>([]);
export const [currentTime, setCurrentTime] = createSignal<number>(-1);

View File

@ -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

View File

@ -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<boolean>(false);

View File

@ -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)',