Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
move language menu item from settings to view
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Jun 18, 2016
1 parent d647c5f commit 940d09c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 36 deletions.
7 changes: 2 additions & 5 deletions interface/i18n/mist.en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
},
"view": {
"label": "View",
"fullscreen": "Toggle Fullscreen"
"fullscreen": "Toggle Fullscreen",
"languages": "Languages"
},
"accounts": {
"label": "Accounts",
Expand Down Expand Up @@ -51,10 +52,6 @@
"close": "Close",
"toFront": "Bring All to Front"
},
"settings": {
"label": "Settings",
"languages": "Languages"
},
"help": {
"label": "Help"
}
Expand Down
7 changes: 2 additions & 5 deletions interface/i18n/mist.zh-TW.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"view": {
"label": "檢視",
"fullscreen": "全螢幕"
"fullscreen": "全螢幕",
"languages": "語言"
},
"accounts": {
"label": "帳號",
Expand Down Expand Up @@ -47,10 +48,6 @@
"close": "關閉",
"toFront": "全部前置"
},
"settings": {
"label": "設定",
"languages": "語言"
},
"help": {
"label": "幫助"
}
Expand Down
45 changes: 19 additions & 26 deletions modules/menuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,21 @@ var menuTempl = function(webviews) {
]
})

let languageMenu =
Object.keys(i18n.options.resources).map(lang_code => {
menuItem = {
label: lang_code,
click: function(){
let mainWindow = Windows.getByType('main');
mainWindow.webContents.executeJavaScript(
`TAPi18n.setLanguage("${lang_code}");`
);
}
}
return menuItem
}
)

// VIEW
menu.push({
label: i18n.t('mist.applicationMenu.view.label'),
Expand All @@ -230,6 +245,10 @@ var menuTempl = function(webviews) {

mainWindow.window.setFullScreen(!mainWindow.window.isFullScreen());
}
},
{
label: i18n.t('mist.applicationMenu.view.languages'),
submenu: languageMenu
}
]
})
Expand Down Expand Up @@ -432,32 +451,6 @@ var menuTempl = function(webviews) {
]
})

let languageMenu =
Object.keys(i18n.options.resources).map(lang_code => {
menuItem = {
label: lang_code,
click: function(){
let mainWindow = Windows.getByType('main');
mainWindow.webContents.executeJavaScript(
`TAPi18n.setLanguage("${lang_code}");`
);
}
}
return menuItem
}
)

// SETTINGS
menu.push({
label: i18n.t('mist.applicationMenu.settings.label'),
submenu: [
{
label: i18n.t('mist.applicationMenu.settings.languages'),
submenu: languageMenu
}
]
})

// HELP
if(process.platform === 'darwin') {
menu.push({
Expand Down

0 comments on commit 940d09c

Please sign in to comment.