OSDN Git Service

update bytom to vapor
[bytom/bytom-electron.git] / modules / menus / application-menu.js
index 9c36021..6c3fc1a 100755 (executable)
@@ -1,6 +1,6 @@
 const { Menu, app, shell, ipcMain, dialog , nativeImage} = require('electron')
 const settings = require('electron-settings')
-global.language = settings.get('browserSetting.core.lang') || app.getLocale()
+global.language = settings.get('lang') || app.getLocale()
 const i18n = require('../i18n.js')
 global.i18n = i18n
 const path = require('path')
@@ -130,7 +130,7 @@ let menuTempl = function () {
 
   // LANGUAGE (VIEW)
   const defaultLanguage = i18n.getBestMatchedLangCode(app.getLocale())
-  let currentLanguage = settings.get('browserSetting.core.lang') || defaultLanguage
+  let currentLanguage = settings.get('lang') || defaultLanguage
   const LanguageMenu = [{
     label: i18n.t('desktop.applicationMenu.view.default'),
     type: 'checkbox',
@@ -148,7 +148,7 @@ let menuTempl = function () {
   },{
     label: i18n.t('desktop.applicationMenu.view.langCodes.zh'),
     type: 'checkbox',
-    checked: currentLanguage === 'zh',
+    checked:  currentLanguage.substring(0,2) == 'zh' ,
     click: (item, focusedWindow) => {
       if (focusedWindow) {
         i18n.changeLanguage('zh', (err, t) => {
@@ -162,7 +162,7 @@ let menuTempl = function () {
   },{
     label: i18n.t('desktop.applicationMenu.view.langCodes.en'),
     type: 'checkbox',
-    checked: currentLanguage === 'en',
+    checked: currentLanguage == 'en',
     click: (item, focusedWindow) => {
       if (focusedWindow) {
         i18n.changeLanguage('en', (err, t) => {
@@ -262,7 +262,7 @@ let menuTempl = function () {
     label: i18n.t('desktop.applicationMenu.develop.logFiles'),
     click() {
       try {
-        shell.showItemInFolder(path.join(app.getPath('userData'), 'logs', 'bytomd', 'bytomd.log'))
+        shell.showItemInFolder(path.join(app.getPath('userData'), 'logs', 'vapord', 'vapord.log'))
       } catch (error) {
         log.error(error)
       }
@@ -312,14 +312,14 @@ let menuTempl = function () {
   }
 
   helpMenu.push({
-    label: i18n.t('desktop.applicationMenu.help.bytomWiki'),
+    label: i18n.t('desktop.applicationMenu.help.vaporWiki'),
     click() {
-      shell.openExternal('https://github.com/bytom/bytom/wiki')
+      shell.openExternal('https://github.com/bytom/vapor/wiki')
     },
   }, {
     label: i18n.t('desktop.applicationMenu.help.reportBug'),
     click() {
-      shell.openExternal('https://github.com/bytom/bytom/issues')
+      shell.openExternal('https://github.com/bytom/vapor/issues')
     },
   })
 
@@ -361,7 +361,7 @@ settings.watch('browserSetting.core.btmAmountUnit', newValue => {
   menu.items[3].submenu.items[0].submenu.items[2].checked = ( btmAmountUnit === 'NEU' )
 })
 
-settings.watch('browserSetting.core.lang', newValue => {
+settings.watch('lang', newValue => {
   i18n.changeLanguage(newValue, (err, t) => {
     if (err) return log.error('i18n: something went wrong loading', err)
     createMenu()