mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
fix(i18n): plugin name, description i18n
This commit is contained in:
@ -12,8 +12,6 @@ export const loadI18n = async () =>
|
||||
}
|
||||
});
|
||||
|
||||
loadI18n();
|
||||
|
||||
export const setLanguage = async (language: string) => await changeLanguage(language);
|
||||
|
||||
export const t = i18t.bind(i18next);
|
||||
|
||||
@ -193,10 +193,10 @@ const showNeedToRestartDialog = (id: string) => {
|
||||
],
|
||||
title: t('main.dialog.need-to-restart.title'),
|
||||
message: t('main.dialog.need-to-restart.message', {
|
||||
pluginName: plugin?.name ?? id,
|
||||
pluginName: plugin?.name?.() ?? id,
|
||||
}),
|
||||
detail: t('main.dialog.need-to-restart.detail', {
|
||||
pluginName: plugin?.name ?? id,
|
||||
pluginName: plugin?.name?.() ?? id,
|
||||
}),
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
|
||||
@ -66,7 +66,7 @@ export const mainMenuTemplate = async (
|
||||
|
||||
const menuResult = Object.entries(getAllMenuTemplate()).map(
|
||||
([id, template]) => {
|
||||
const pluginLabel = allPlugins[id]?.name ?? id;
|
||||
const pluginLabel = allPlugins[id]?.name?.() ?? id;
|
||||
|
||||
if (!config.plugins.isEnabled(id)) {
|
||||
return [
|
||||
@ -92,8 +92,8 @@ export const mainMenuTemplate = async (
|
||||
const availablePlugins = Object.keys(allPlugins);
|
||||
const pluginMenus = availablePlugins
|
||||
.sort((a, b) => {
|
||||
const aPluginLabel = allPlugins[a]?.name ?? a;
|
||||
const bPluginLabel = allPlugins[b]?.name ?? b;
|
||||
const aPluginLabel = allPlugins[a]?.name?.() ?? a;
|
||||
const bPluginLabel = allPlugins[b]?.name?.() ?? b;
|
||||
|
||||
return aPluginLabel.localeCompare(bPluginLabel);
|
||||
})
|
||||
@ -101,7 +101,7 @@ export const mainMenuTemplate = async (
|
||||
const predefinedTemplate = menuResult.find((it) => it[0] === id);
|
||||
if (predefinedTemplate) return predefinedTemplate[1];
|
||||
|
||||
const pluginLabel = allPlugins[id]?.name ?? id;
|
||||
const pluginLabel = allPlugins[id]?.name?.() ?? id;
|
||||
|
||||
return pluginEnabledMenu(id, pluginLabel, true, innerRefreshMenu);
|
||||
});
|
||||
|
||||
@ -43,8 +43,8 @@ interface AdblockerConfig {
|
||||
}
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.adblocker.name'),
|
||||
description: t('plugins.adblocker.description'),
|
||||
name: () => t('plugins.adblocker.name'),
|
||||
description: () => t('plugins.adblocker.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: true,
|
||||
|
||||
@ -8,8 +8,8 @@ import { t } from '@/i18n';
|
||||
import type { VideoDataChanged } from '@/types/video-data-changed';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.album-color-theme.name'),
|
||||
description: t('plugins.album-color-theme.description'),
|
||||
name: () => t('plugins.album-color-theme.name'),
|
||||
description: () => t('plugins.album-color-theme.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -25,8 +25,8 @@ const defaultConfig: AmbientModePluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.ambient-mode.name'),
|
||||
description: t('plugins.ambient-mode.description'),
|
||||
name: () => t('plugins.ambient-mode.name'),
|
||||
description: () => t('plugins.ambient-mode.description'),
|
||||
restartNeeded: false,
|
||||
config: defaultConfig,
|
||||
stylesheets: [style],
|
||||
|
||||
@ -2,8 +2,8 @@ import { createPlugin } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.audio-compressor.name'),
|
||||
description: t('plugins.audio-compressor.description'),
|
||||
name: () => t('plugins.audio-compressor.name'),
|
||||
description: () => t('plugins.audio-compressor.description'),
|
||||
|
||||
renderer() {
|
||||
document.addEventListener(
|
||||
|
||||
@ -3,8 +3,8 @@ import style from './style.css?inline';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.blur-nav-bar.name'),
|
||||
description: t('plugins.blur-nav-bar.description'),
|
||||
name: () => t('plugins.blur-nav-bar.name'),
|
||||
description: () => t('plugins.blur-nav-bar.description'),
|
||||
restartNeeded: true,
|
||||
stylesheets: [style],
|
||||
renderer() {},
|
||||
|
||||
@ -2,8 +2,8 @@ import { createPlugin } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.bypass-age-restrictions.name'),
|
||||
description: t('plugins.bypass-age-restrictions.description'),
|
||||
name: () => t('plugins.bypass-age-restrictions.name'),
|
||||
description: () => t('plugins.bypass-age-restrictions.description'),
|
||||
restartNeeded: true,
|
||||
|
||||
// See https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass#userscript
|
||||
|
||||
@ -19,8 +19,8 @@ export default createPlugin<
|
||||
},
|
||||
CaptionsSelectorConfig
|
||||
>({
|
||||
name: t('plugins.captions-selector.name'),
|
||||
description: t('plugins.captions-selector.description'),
|
||||
name: () => t('plugins.captions-selector.name'),
|
||||
description: () => t('plugins.captions-selector.description'),
|
||||
config: {
|
||||
enabled: false,
|
||||
disableCaptions: false,
|
||||
|
||||
@ -9,8 +9,8 @@ export default createPlugin<
|
||||
isCompactSidebarDisabled: () => boolean;
|
||||
}
|
||||
>({
|
||||
name: t('plugins.compact-sidebar.name'),
|
||||
description: t('plugins.compact-sidebar.description'),
|
||||
name: () => t('plugins.compact-sidebar.name'),
|
||||
description: () => t('plugins.compact-sidebar.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -30,8 +30,8 @@ export default createPlugin<
|
||||
},
|
||||
CrossfadePluginConfig
|
||||
>({
|
||||
name: t('plugins.crossfade.name'),
|
||||
description: t('plugins.crossfade.description'),
|
||||
name: () => t('plugins.crossfade.name'),
|
||||
description: () => t('plugins.crossfade.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -21,8 +21,8 @@ export default createPlugin<
|
||||
},
|
||||
DisableAutoPlayPluginConfig
|
||||
>({
|
||||
name: t('plugins.disable-autoplay.name'),
|
||||
description: t('plugins.disable-autoplay.description'),
|
||||
name: () => t('plugins.disable-autoplay.name'),
|
||||
description: () => t('plugins.disable-autoplay.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -36,8 +36,8 @@ export type DiscordPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.discord.name'),
|
||||
description: t('plugins.discord.description'),
|
||||
name: () => t('plugins.discord.name'),
|
||||
description: () => t('plugins.discord.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -26,8 +26,8 @@ export const defaultConfig: DownloaderPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.downloader.name'),
|
||||
description: t('plugins.downloader.description'),
|
||||
name: () => t('plugins.downloader.name'),
|
||||
description: () => t('plugins.downloader.description'),
|
||||
restartNeeded: true,
|
||||
config: defaultConfig,
|
||||
stylesheets: [style],
|
||||
|
||||
@ -2,8 +2,8 @@ import { createPlugin } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.exponential-volume.name'),
|
||||
description: t('plugins.exponential-volume.description'),
|
||||
name: () => t('plugins.exponential-volume.name'),
|
||||
description: () => t('plugins.exponential-volume.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -10,8 +10,8 @@ export interface InAppMenuConfig {
|
||||
hideDOMWindowControls: boolean;
|
||||
}
|
||||
export default createPlugin({
|
||||
name: t('plugins.in-app-menu.name'),
|
||||
description: t('plugins.in-app-menu.description'),
|
||||
name: () => t('plugins.in-app-menu.name'),
|
||||
description: () => t('plugins.in-app-menu.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled:
|
||||
|
||||
@ -34,8 +34,8 @@ export interface LastFmPluginConfig {
|
||||
}
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.last-fm.name'),
|
||||
description: t('plugins.last-fm.description'),
|
||||
name: () => t('plugins.last-fm.name'),
|
||||
description: () => t('plugins.last-fm.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -24,8 +24,8 @@ type LumiaData = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.lumiastream.name'),
|
||||
description: t('plugins.lumiastream.description'),
|
||||
name: () => t('plugins.lumiastream.name'),
|
||||
description: () => t('plugins.lumiastream.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -10,8 +10,8 @@ export type LyricsGeniusPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.lyrics-genius.name'),
|
||||
description: t('plugins.lyrics-genius.description'),
|
||||
name: () => t('plugins.lyrics-genius.name'),
|
||||
description: () => t('plugins.lyrics-genius.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -8,8 +8,8 @@ import forwardHTML from './templates/forward.html?raw';
|
||||
import backHTML from './templates/back.html?raw';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.navigation.name'),
|
||||
description: t('plugins.navigation.description'),
|
||||
name: () => t('plugins.navigation.name'),
|
||||
description: () => t('plugins.navigation.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: true,
|
||||
|
||||
@ -3,8 +3,8 @@ import { createPlugin } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.no-google-login.name'),
|
||||
description: t('plugins.no-google-login.description'),
|
||||
name: () => t('plugins.no-google-login.name'),
|
||||
description: () => t('plugins.no-google-login.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -36,8 +36,8 @@ export const defaultConfig: NotificationsPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.notifications.name'),
|
||||
description: t('plugins.notifications.description'),
|
||||
name: () => t('plugins.notifications.name'),
|
||||
description: () => t('plugins.notifications.description'),
|
||||
restartNeeded: true,
|
||||
config: defaultConfig,
|
||||
menu: onMenu,
|
||||
|
||||
@ -19,8 +19,8 @@ export type PictureInPicturePluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.picture-in-picture.name'),
|
||||
description: t('plugins.picture-in-picture.description'),
|
||||
name: () => t('plugins.picture-in-picture.name'),
|
||||
description: () => t('plugins.picture-in-picture.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
'enabled': false,
|
||||
|
||||
@ -3,8 +3,8 @@ import { onPlayerApiReady, onUnload } from './renderer';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.playback-speed.name'),
|
||||
description: t('plugins.playback-speed.description'),
|
||||
name: () => t('plugins.playback-speed.name'),
|
||||
description: () => t('plugins.playback-speed.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -30,8 +30,8 @@ export type PreciseVolumePluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.precise-volume.name'),
|
||||
description: t('plugins.precise-volume.description'),
|
||||
name: () => t('plugins.precise-volume.name'),
|
||||
description: () => t('plugins.precise-volume.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -9,8 +9,8 @@ import { t } from '@/i18n';
|
||||
import type { YoutubePlayer } from '@/types/youtube-player';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.quality-changer.name'),
|
||||
description: t('plugins.quality-changer.description'),
|
||||
name: () => t('plugins.quality-changer.name'),
|
||||
description: () => t('plugins.quality-changer.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -16,8 +16,8 @@ export type ShortcutsPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.shortcuts.name'),
|
||||
description: t('plugins.shortcuts.description'),
|
||||
name: () => t('plugins.shortcuts.name'),
|
||||
description: () => t('plugins.shortcuts.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -8,8 +8,8 @@ export type SkipSilencesPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.skip-silences.name'),
|
||||
description: t('plugins.skip-silences.description'),
|
||||
name: () => t('plugins.skip-silences.name'),
|
||||
description: () => t('plugins.skip-silences.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -25,8 +25,8 @@ export type SponsorBlockPluginConfig = {
|
||||
let currentSegments: Segment[] = [];
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.sponsorblock.name'),
|
||||
description: t('plugins.sponsorblock.description'),
|
||||
name: () => t('plugins.sponsorblock.name'),
|
||||
description: () => t('plugins.sponsorblock.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -12,8 +12,8 @@ import { mediaIcons } from '@/types/media-icons';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.taskbar-mediacontrol.name'),
|
||||
description: t('plugins.taskbar-mediacontrol.description'),
|
||||
name: () => t('plugins.taskbar-mediacontrol.name'),
|
||||
description: () => t('plugins.taskbar-mediacontrol.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -6,8 +6,8 @@ import registerCallback from '@/providers/song-info';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.touchbar.name'),
|
||||
description: t('plugins.touchbar.description'),
|
||||
name: () => t('plugins.touchbar.name'),
|
||||
description: () => t('plugins.touchbar.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -19,8 +19,8 @@ interface Data {
|
||||
}
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.tuna-obs.name'),
|
||||
description: t('plugins.tuna-obs.description'),
|
||||
name: () => t('plugins.tuna-obs.name'),
|
||||
description: () => t('plugins.tuna-obs.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -18,8 +18,8 @@ export type VideoTogglePluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.video-toggle.name'),
|
||||
description: t('plugins.video-toggle.description'),
|
||||
name: () => t('plugins.video-toggle.name'),
|
||||
description: () => t('plugins.video-toggle.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -58,8 +58,8 @@ export type VisualizerPluginConfig = {
|
||||
};
|
||||
|
||||
export default createPlugin({
|
||||
name: t('plugins.visualizer.name'),
|
||||
description: t('plugins.visualizer.description'),
|
||||
name: () => t('plugins.visualizer.name'),
|
||||
description: () => t('plugins.visualizer.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
|
||||
@ -44,9 +44,9 @@ export interface PluginDef<
|
||||
RendererProperties,
|
||||
Config extends PluginConfig = PluginConfig,
|
||||
> {
|
||||
name: string;
|
||||
name: () => string;
|
||||
authors?: Author[];
|
||||
description?: string;
|
||||
description?: () => string;
|
||||
config?: Config;
|
||||
|
||||
menu?: (
|
||||
|
||||
Reference in New Issue
Block a user