Skip to content

Commit

Permalink
add Japanese help into Help menu (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Apr 12, 2020
1 parent 1015163 commit 30980b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ Check "Tool > Experimental > Reuse analysis" in the menu. This is expected to be
* Read variations in SGF.
* Show start-up log when engine is down.
* Improve thumbnails (delay, color, etc.).
* Add Japanese help.
* Fix blur in HiDPI display.
* Experimentally support saving/loading analyses in SGF. (See the above section.)

Expand Down
10 changes: 7 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// -*- coding: utf-8 -*-

/////////////////////////////////////////////////
// electron
const electron = require('electron')
Expand Down Expand Up @@ -610,7 +612,8 @@ function menu_template(win) {
{role: 'toggleDevTools'},
])
const help_menu = menu('Help', [
item('Help', undefined, help),
item('en (English)', undefined, help),
item('ja (日本語)', undefined, () => open_help('help_ja.html')),
])
return [file_menu, edit_menu, view_menu, tool_menu, engine_menu,
...preset_menu_maybe({menu, item, sep, white_unloader_item, win}),
Expand Down Expand Up @@ -1049,14 +1052,15 @@ function close_window_or_cut_sequence(win) {
attached ? null :
(sequence.length <= 1 && game.is_empty()) ? win.close() : cut_sequence()
}
function help() {
function help() {open_help('help.html')}
function open_help(file_name) {
const menu = [
{label: 'File', submenu: [{role: 'close'}]},
{label: 'View',
submenu: [{role: 'zoomIn'}, {role: 'zoomOut'}, {role: 'resetZoom'}]}
]
const opt = {webPreferences: {nodeIntegration: true}}
get_new_window('help.html', opt).setMenu(Menu.buildFromTemplate(menu))
get_new_window(file_name, opt).setMenu(Menu.buildFromTemplate(menu))
}
function info_text() {
const f = (label, s) => s ?
Expand Down

0 comments on commit 30980b0

Please sign in to comment.