mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-14 14:50:50 +08:00
✨ feat: 国际化功能基础实现
This commit is contained in:
@@ -2,6 +2,7 @@ import { electronApp, optimizer } from '@electron-toolkit/utils';
|
||||
import { app, ipcMain, nativeImage } from 'electron';
|
||||
import { join } from 'path';
|
||||
|
||||
import i18n from '../i18n/main';
|
||||
import { loadLyricWindow } from './lyric';
|
||||
import { initializeConfig } from './modules/config';
|
||||
import { initializeFileManager } from './modules/fileManager';
|
||||
@@ -95,6 +96,13 @@ if (!isSingleInstance) {
|
||||
registerShortcuts(mainWindow);
|
||||
});
|
||||
|
||||
// 监听语言切换
|
||||
ipcMain.on('change-language', (_, locale) => {
|
||||
i18n.global.locale = locale;
|
||||
// 通知所有窗口语言已更改
|
||||
mainWindow?.webContents.send('language-changed', locale);
|
||||
});
|
||||
|
||||
// 所有窗口关闭时的处理
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
|
||||
@@ -23,6 +23,7 @@ type SetConfig = {
|
||||
musicQuality: string;
|
||||
fontFamily: string;
|
||||
fontScope: 'global' | 'lyric';
|
||||
language: string;
|
||||
};
|
||||
interface StoreType {
|
||||
set: SetConfig;
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
"fontFamily": "system-ui",
|
||||
"fontScope": "global",
|
||||
"autoPlay": false,
|
||||
"downloadPath": ""
|
||||
"downloadPath": "",
|
||||
"language": "zh-CN"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user