feat: add support i18n (#1468)

This commit is contained in:
JellyBrick
2023-12-01 01:30:46 +09:00
committed by GitHub
parent 7f71c36dc0
commit 7401cf69ad
65 changed files with 1226 additions and 303 deletions

View File

@ -2,6 +2,7 @@ import style from './style.css?inline';
import { createPlugin } from '@/utils';
import { onConfigChange, onMainLoad } from './main';
import { onRendererLoad } from './renderer';
import { t } from '@/i18n';
export type LyricsGeniusPluginConfig = {
enabled: boolean;
@ -9,8 +10,8 @@ export type LyricsGeniusPluginConfig = {
};
export default createPlugin({
name: 'Lyrics Genius',
description: 'Adds lyrics support for most songs',
name: t('plugins.lyrics-genius.name'),
description: t('plugins.lyrics-genius.description'),
restartNeeded: true,
config: {
enabled: false,
@ -22,7 +23,7 @@ export default createPlugin({
return [
{
label: 'Romanized Lyrics',
label: t('plugins.lyrics-genius.menu.romanized-lyrics'),
type: 'checkbox',
checked: config.romanizedLyrics,
click(item) {

View File

@ -1,6 +1,9 @@
import { LoggerPrefix } from '@/utils';
import type { SongInfo } from '@/providers/song-info';
import type { RendererContext } from '@/types/contexts';
import type { LyricsGeniusPluginConfig } from '@/plugins/lyrics-genius/index';
import { t } from '@/i18n';
export const onRendererLoad = ({
ipc: { invoke, on },
@ -55,7 +58,10 @@ export const onRendererLoad = ({
}
if (window.electronIs.dev()) {
console.log('Fetched lyrics from Genius');
console.log(
LoggerPrefix,
t('plugins.lyric-genius.renderer.fetched-lyrics'),
);
}
const tryToInjectLyric = (callback?: () => void) => {