mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-14 11:34:43 +08:00
feat(i18n): 后端添加国际化支持、优化前端界面
- 后端添加并实现国际化支持 - 前端引入 vue-i18n 模块(尚未添加国际化逻辑) - 优化用户界面样式,统一输入框和标签样式
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Styles, CaptionItem, Controls } from '../types'
|
||||
import { UILanguage, Styles, CaptionItem, Controls } from '../types'
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
@@ -29,6 +29,7 @@ const defaultControls: Controls = {
|
||||
|
||||
|
||||
class AllConfig {
|
||||
uiLanguage: UILanguage = 'ja'
|
||||
styles: Styles = {...defaultStyles};
|
||||
controls: Controls = {...defaultControls};
|
||||
captionLog: CaptionItem[] = [];
|
||||
@@ -39,14 +40,16 @@ class AllConfig {
|
||||
const configPath = path.join(app.getPath('userData'), 'config.json')
|
||||
if(fs.existsSync(configPath)){
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'))
|
||||
this.setStyles(config.styles)
|
||||
this.setControls(config.controls)
|
||||
if(config.uiLanguage) this.uiLanguage = config.uiLanguage
|
||||
if(config.styles) this.setStyles(config.styles)
|
||||
if(config.controls) this.setControls(config.controls)
|
||||
console.log('[INFO] Read Config from:', configPath)
|
||||
}
|
||||
}
|
||||
|
||||
public writeConfig() {
|
||||
const config = {
|
||||
uiLanguage: this.uiLanguage,
|
||||
controls: this.controls,
|
||||
styles: this.styles
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user