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:
@ -2,6 +2,7 @@ import prompt from 'custom-electron-prompt';
|
||||
|
||||
import promptOptions from '@/providers/prompt-options';
|
||||
import { createBackend } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createBackend({
|
||||
start({ ipc: { handle }, window }) {
|
||||
@ -10,8 +11,10 @@ export default createBackend({
|
||||
async (captionLabels: Record<string, string>, currentIndex: string) =>
|
||||
await prompt(
|
||||
{
|
||||
title: 'Choose Caption',
|
||||
label: `Current Caption: ${captionLabels[currentIndex] || 'None'}`,
|
||||
title: t('plugins.captions-selector.prompt.selector.title'),
|
||||
label: t('plugins.captions-selector.prompt.selector.label', {
|
||||
language: captionLabels[currentIndex] || t('plugins.captions-selector.prompt.selector.none'),
|
||||
}),
|
||||
type: 'select',
|
||||
value: currentIndex,
|
||||
selectOptions: captionLabels,
|
||||
|
||||
@ -3,6 +3,7 @@ import { YoutubePlayer } from '@/types/youtube-player';
|
||||
|
||||
import backend from './back';
|
||||
import renderer, { CaptionsSelectorConfig, LanguageOptions } from './renderer';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin<
|
||||
unknown,
|
||||
@ -18,8 +19,8 @@ export default createPlugin<
|
||||
},
|
||||
CaptionsSelectorConfig
|
||||
>({
|
||||
name: 'Captions Selector',
|
||||
description: 'Caption selector for YouTube Music audio tracks',
|
||||
name: t('plugins.captions-selector.name'),
|
||||
description: t('plugins.captions-selector.description'),
|
||||
config: {
|
||||
enabled: false,
|
||||
disableCaptions: false,
|
||||
@ -31,7 +32,7 @@ export default createPlugin<
|
||||
const config = await getConfig();
|
||||
return [
|
||||
{
|
||||
label: 'Automatically select last used caption',
|
||||
label: t('plugins.captions-selector.menu.autoload'),
|
||||
type: 'checkbox',
|
||||
checked: config.autoload as boolean,
|
||||
click(item) {
|
||||
@ -39,7 +40,7 @@ export default createPlugin<
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'No captions by default',
|
||||
label: t('plugins.captions-selector.menu.disable-captions'),
|
||||
type: 'checkbox',
|
||||
checked: config.disableCaptions as boolean,
|
||||
click(item) {
|
||||
|
||||
Reference in New Issue
Block a user