The swiss army knife of lossless video/audio editing
fix menu
Mikael Finstadd5744215e85e
diff --git a/public/menu.js b/public/menu.jsindex 3b56aa0b..20936e3e 100644--- a/public/menu.js+++ b/public/menu.js@@ -1,9 +1,9 @@const electron = require('electron');-const i18n = require('i18next');+const { t } = require('i18next');// menu-safe i18n.t:// https://github.com/mifi/lossless-cut/issues/1456-const t = (key) => i18n.t(key).replace(/&/g, '&&');+const esc = (val) => val.replace(/&/g, '&&');const { Menu } = electron;@@ -14,88 +14,88 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {...(process.platform === 'darwin' ? [{ role: 'appMenu' }] : []),{- label: t('File'),+ label: esc(t('File')),submenu: [{- label: t('Open'),+ label: esc(t('Open')),accelerator: 'CmdOrCtrl+O',async click() {mainWindow.webContents.send('openFilesDialog');},},{- label: t('Close'),+ label: esc(t('Close')),accelerator: 'CmdOrCtrl+W',async click() {mainWindow.webContents.send('closeCurrentFile');},},{- label: t('Close batch'),+ label: esc(t('Close batch')),async click() {mainWindow.webContents.send('closeBatchFiles');},},{ type: 'separator' },{- label: t('Import project (LLC)...'),+ label: esc(t('Import project (LLC)...')),click() {mainWindow.webContents.send('importEdlFile', 'llc');},},{- label: t('Export project (LLC)...'),+ label: esc(t('Export project (LLC)...')),click() {mainWindow.webContents.send('exportEdlFile', 'llc');},},{- label: t('Import project'),+ label: esc(t('Import project')),submenu: [{- label: t('Times in seconds (CSV)'),+ label: esc(t('Times in seconds (CSV)')),click() {mainWindow.webContents.send('importEdlFile', 'csv');},},{- label: t('Frame numbers (CSV)'),+ label: esc(t('Frame numbers (CSV)')),click() {mainWindow.webContents.send('importEdlFile', 'csv-frames');},},{- label: t('EDL (MPlayer)'),+ label: esc(t('EDL (MPlayer)')),click() {mainWindow.webContents.send('importEdlFile', 'mplayer');},},{- label: t('Text chapters / YouTube'),+ label: esc(t('Text chapters / YouTube')),click() {mainWindow.webContents.send('importEdlFile', 'youtube');},},{- label: t('DaVinci Resolve / Final Cut Pro XML'),+ label: esc(t('DaVinci Resolve / Final Cut Pro XML')),click() {mainWindow.webContents.send('importEdlFile', 'xmeml');},},{- label: t('Final Cut Pro FCPX / FCPXML'),+ label: esc(t('Final Cut Pro FCPX / FCPXML')),click() {mainWindow.webContents.send('importEdlFile', 'fcpxml');},},{- label: t('CUE sheet file'),+ label: esc(t('CUE sheet file')),click() {mainWindow.webContents.send('importEdlFile', 'cue');},},{- label: t('PotPlayer Bookmarks (.pbf)'),+ label: esc(t('PotPlayer Bookmarks (.pbf)')),click() {mainWindow.webContents.send('importEdlFile', 'pbf');},@@ -103,34 +103,34 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {],},{- label: t('Export project'),+ label: esc(t('Export project')),submenu: [{- label: t('Times in seconds (CSV)'),+ label: esc(t('Times in seconds (CSV)')),click() {mainWindow.webContents.send('exportEdlFile', 'csv');},},{- label: t('Timestamps (CSV)'),+ label: esc(t('Timestamps (CSV)')),click() {mainWindow.webContents.send('exportEdlFile', 'csv-human');},},{- label: t('Frame numbers (CSV)'),+ label: esc(t('Frame numbers (CSV)')),click() {mainWindow.webContents.send('exportEdlFile', 'csv-frames');},},{- label: t('Timestamps (TSV/TXT)'),+ label: esc(t('Timestamps (TSV/TXT)')),click() {mainWindow.webContents.send('exportEdlFile', 'tsv-human');},},{- label: t('Start times as YouTube Chapters'),+ label: esc(t('Start times as YouTube Chapters')),click() {mainWindow.webContents.send('exportEdlYouTube');},@@ -139,13 +139,13 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {},{ type: 'separator' },{- label: t('Convert to supported format'),+ label: esc(t('Convert to supported format')),click() {mainWindow.webContents.send('html5ify');},},{- label: t('Fix incorrect duration'),+ label: esc(t('Fix incorrect duration')),click() {mainWindow.webContents.send('fixInvalidDuration');},@@ -154,7 +154,7 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {{ type: 'separator' },{- label: t('Settings'),+ label: esc(t('Settings')),accelerator: 'CmdOrCtrl+,',click() {mainWindow.webContents.send('toggleSettings');@@ -165,7 +165,7 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {...(process.platform !== 'darwin' ? [{ type: 'separator' },{- label: t('Exit'),+ label: esc(t('Exit')),click() {app.quit();},@@ -175,83 +175,83 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {},{- label: t('Edit'),+ label: esc(t('Edit')),submenu: [// https://github.com/mifi/lossless-cut/issues/610// https://github.com/mifi/lossless-cut/issues/1183- { role: 'undo', label: t('Undo') },- { role: 'redo', label: t('Redo') },+ { role: 'undo', label: esc(t('Undo')) },+ { role: 'redo', label: esc(t('Redo')) },{ type: 'separator' },- { role: 'cut', label: t('Cut') },- { role: 'copy', label: t('Copy') },- { role: 'paste', label: t('Paste') },- { role: 'selectall', label: t('Select All') },+ { role: 'cut', label: esc(t('Cut')) },+ { role: 'copy', label: esc(t('Copy')) },+ { role: 'paste', label: esc(t('Paste')) },+ { role: 'selectall', label: esc(t('Select All')) },{ type: 'separator' },{- label: t('Segments'),+ label: esc(t('Segments')),submenu: [{- label: t('Clear all segments'),+ label: esc(t('Clear all segments')),click() {mainWindow.webContents.send('clearSegments');},},{- label: t('Reorder segments by start time'),+ label: esc(t('Reorder segments by start time')),click() {mainWindow.webContents.send('reorderSegsByStartTime');},},{- label: t('Create num segments'),+ label: esc(t('Create num segments')),click() {mainWindow.webContents.send('createNumSegments');},},{- label: t('Create fixed duration segments'),+ label: esc(t('Create fixed duration segments')),click() {mainWindow.webContents.send('createFixedDurationSegments');},},{- label: t('Create random segments'),+ label: esc(t('Create random segments')),click() {mainWindow.webContents.send('createRandomSegments');},},{- label: t('Invert all segments on timeline'),+ label: esc(t('Invert all segments on timeline')),click() {mainWindow.webContents.send('invertAllSegments');},},{- label: t('Fill gaps between segments'),+ label: esc(t('Fill gaps between segments')),click() {mainWindow.webContents.send('fillSegmentsGaps');},},{- label: t('Combine overlapping segments'),+ label: esc(t('Combine overlapping segments')),click() {mainWindow.webContents.send('combineOverlappingSegments');},},{- label: t('Shuffle segments order'),+ label: esc(t('Shuffle segments order')),click() {mainWindow.webContents.send('shuffleSegments');},},{- label: t('Shift all segments on timeline'),+ label: esc(t('Shift all segments on timeline')),click() {mainWindow.webContents.send('shiftAllSegmentTimes');},},{- label: t('Align segment times to keyframes'),+ label: esc(t('Align segment times to keyframes')),click() {mainWindow.webContents.send('alignSegmentTimesToKeyframes');},@@ -259,16 +259,16 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {],},{- label: t('Tracks'),+ label: esc(t('Tracks')),submenu: [{- label: t('Extract all tracks'),+ label: esc(t('Extract all tracks')),click() {mainWindow.webContents.send('extractAllStreams');},},{- label: t('Edit tracks / metadata tags'),+ label: esc(t('Edit tracks / metadata tags')),click() {mainWindow.webContents.send('showStreamsSelector');},@@ -279,106 +279,106 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {},{- label: t('View'),+ label: esc(t('View')),submenu: [- { role: 'togglefullscreen', label: t('Toggle Full Screen') },+ { role: 'togglefullscreen', label: esc(t('Toggle Full Screen')) },],},// On Windows the windowMenu has a close Ctrl+W which clashes with File->Close shortcut...(process.platform === 'darwin'- ? [{ role: 'windowMenu', label: t('Window') }]+ ? [{ role: 'windowMenu', label: esc(t('Window')) }]: [{- label: t('Window'),- submenu: [{ role: 'minimize', label: t('Minimize') }],+ label: esc(t('Window')),+ submenu: [{ role: 'minimize', label: esc(t('Minimize')) }],}]),{- label: t('Tools'),+ label: esc(t('Tools')),submenu: [{- label: t('Merge/concatenate files'),+ label: esc(t('Merge/concatenate files')),click() {mainWindow.webContents.send('concatCurrentBatch');},},{- label: t('Set custom start offset/timecode'),+ label: esc(t('Set custom start offset/timecode')),click() {mainWindow.webContents.send('askSetStartTimeOffset');},},{- label: t('Detect black scenes'),+ label: esc(t('Detect black scenes')),click() {mainWindow.webContents.send('detectBlackScenes');},},{- label: t('Detect silent scenes'),+ label: esc(t('Detect silent scenes')),click() {mainWindow.webContents.send('detectSilentScenes');},},{- label: t('Detect scene changes'),+ label: esc(t('Detect scene changes')),click() {mainWindow.webContents.send('detectSceneChanges');},},{- label: t('Create segments from keyframes'),+ label: esc(t('Create segments from keyframes')),click() {mainWindow.webContents.send('createSegmentsFromKeyframes');},},{- label: t('Last ffmpeg commands'),+ label: esc(t('Last ffmpeg commands')),click() { mainWindow.webContents.send('toggleLastCommands'); },},{ type: 'separator' },- { role: 'toggleDevTools', label: t('Toggle Developer Tools') },+ { role: 'toggleDevTools', label: esc(t('Toggle Developer Tools')) },],},{role: 'help',- label: t('Help'),+ label: esc(t('Help')),submenu: [{- label: t('How to use'),+ label: esc(t('How to use')),click() { electron.shell.openExternal('https://mifi.no/losslesscut/usage'); },},{- label: t('FAQ'),+ label: esc(t('FAQ')),click() { electron.shell.openExternal('https://mifi.no/losslesscut/faq'); },},{- label: t('Troubleshooting'),+ label: esc(t('Troubleshooting')),click() { electron.shell.openExternal('https://mifi.no/losslesscut/troubleshooting'); },},{- label: t('Learn More'),+ label: esc(t('Learn More')),click() { electron.shell.openExternal(homepage); },},{- label: t('Licenses'),+ label: esc(t('Licenses')),click() { electron.shell.openExternal(licensesPage); },},{ type: 'separator' },{- label: t('Keyboard & mouse shortcuts'),+ label: esc(t('Keyboard & mouse shortcuts')),click() {mainWindow.webContents.send('toggleKeyboardShortcuts');},},{- label: t('Report an error'),+ label: esc(t('Report an error')),click() { mainWindow.webContents.send('openSendReportDialog'); },},...(!isStoreBuild ? [{- label: t('Version'),+ label: esc(t('Version')),click() { mainWindow.webContents.send('openAbout'); },},] : []),@@ -388,10 +388,10 @@ module.exports = ({ app, mainWindow, newVersion, isStoreBuild }) => {if (!isStoreBuild && newVersion) {menu.push({- label: t('New version!'),+ label: esc(t('New version!')),submenu: [{- label: t('Download {{version}}', { version: newVersion }),+ label: esc(t('Download {{version}}', { version: newVersion })),click() { electron.shell.openExternal(getReleaseUrl(newVersion)); },},],