新增首次运行时自动根据当前系统使用的语言设置软件显示的语言

This commit is contained in:
lyswhut
2020-06-24 16:12:02 +08:00
parent 637727faa0
commit cc5d119ba4
71 changed files with 91 additions and 14 deletions
+6 -2
View File
@@ -105,8 +105,8 @@ export default {
},
},
created() {
rendererOn(NAMES.winLyric.set_lyric_config, (event, config) => this.lrcConfig = config)
rendererInvoke(NAMES.winLyric.get_lyric_config).then(config => this.lrcConfig = config)
rendererOn(NAMES.winLyric.set_lyric_config, (event, config) => this.handleUpdateConfig(config))
rendererInvoke(NAMES.winLyric.get_lyric_config).then(config => this.handleUpdateConfig(config))
},
mounted() {
document.addEventListener('mousemove', this.handleMouseMove)
@@ -117,6 +117,10 @@ export default {
document.removeEventListener('mouseup', this.handleMouseUp)
},
methods: {
handleUpdateConfig({ config, languageId }) {
this.lrcConfig = config
if (this.$i18n.locale !== languageId && languageId != null) this.$i18n.locale = languageId
},
handleMouseDown(origin, event) {
this.handleMouseUp()
this.resize.origin = origin
+2 -2
View File
@@ -14,8 +14,8 @@ import messages from '../../renderer/lang'
Vue.use(VueI18n)
const i18n = window.i18n = new VueI18n({
locale: 'cns',
fallbackLocale: 'cns',
locale: 'zh-cn',
fallbackLocale: 'zh-cn',
messages,
})