Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 4, 2016
1 parent 79744a0 commit 92ce951
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ function create(win, opts) {
type: 'separator'
});
}

// apply custom labels for default menu items
if (opts.labels) {
// Apply custom labels for default menu items
for (const menuItem of menuTpl) {
if (opts.labels[menuItem.id] !== undefined) {
if (opts.labels[menuItem.id]) {
menuItem.label = opts.labels[menuItem.id];
}
}
}

// filter out leading/trailing separators
// TODO: https://github.com/electron/electron/issues/5869
menuTpl = delUnusedElements(menuTpl);
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
"envs": [
"node",
"browser"
],
"rules": {
"import/no-extraneous-dependencies": "off"
}
]
}
}
17 changes: 9 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ Default: `{}`
Overwrite labels for the default menu items. Useful for i18n.

Format:

```js
labels: {
cut: 'Configured Cut',
copy: 'Configured Copy',
paste: 'Configured Paste',
save: 'Configured Save Image',
copyLink: 'Configured Copy Link',
inspect: 'Configured Inspect'
},
labels: {
cut: 'Configured Cut',
copy: 'Configured Copy',
paste: 'Configured Paste',
save: 'Configured Save Image',
copyLink: 'Configured Copy Link',
inspect: 'Configured Inspect'
}
```

## Related
Expand Down

0 comments on commit 92ce951

Please sign in to comment.