2 lines
5.1 KiB
JavaScript
2 lines
5.1 KiB
JavaScript
export const messagesSource = "\n\n const APP_MESSAGES = {\n actions: {\n raw_torrent: 'Add torrent',\n add_torrent_raw: 'Add torrent file',\n add_magnet: 'Add magnet link',\n add: 'Add torrent',\n // Note: Start is intentionally noun-free so queued/running UI stays consistent with the other short action labels.\n start: 'Start',\n pause: 'Pause torrent',\n stop: 'Stop torrent',\n resume: 'Resume torrent',\n remove: 'Remove torrent',\n erase: 'Delete torrent',\n delete: 'Delete torrent',\n move: 'Move torrent',\n recheck: 'Force recheck',\n reannounce: 'Reannounce',\n set_label: 'Update label',\n label: 'Update label'\n },\n\n toast: {\n operationStarted: ({ action }) => `${actionLabel(action)} started`,\n\n operationDone: ({ action }) => `${actionLabel(action)} done`,\n\n operationFailed: ({ action, error }) =>\n `${actionLabel(action)} failed: ${error || 'unknown error'}`,\n\n actionQueued: ({ action, parts }) =>\n Number(parts || 1) > 1\n ? `${actionLabel(action)} queued in ${parts} parts`\n : `${actionLabel(action)} queued`,\n\n moveQueued: ({ parts, physical }) =>\n Number(parts || 1) > 1\n ? `Move queued in ${parts} parts`\n : physical\n ? 'Physical move queued'\n : 'Move queued',\n\n addQueued: () => 'Torrent add queued',\n\n addQueuedSkipped: ({ count }) =>\n `Torrent add queued, skipped ${count} duplicate torrent(s)`,\n\n addTooLarge: () =>\n 'One or more .torrent files exceed the current rTorrent XML-RPC upload limit. Open rTorrent config and set network.xmlrpc.size_limit to e.g. 16M.',\n\n dropOnlyTorrents: () => 'Drop .torrent files only',\n\n droppedAddedSkipped: ({ queued, skipped }) =>\n `Added ${queued} torrent(s), skipped ${skipped} duplicate(s)`,\n\n droppedAdded: ({ queued }) => `Added ${queued} torrent(s)`,\n\n droppedSkipped: ({ skipped }) =>\n `Skipped ${skipped} duplicate torrent(s)`,\n\n droppedNone: () => 'No torrents were added',\n\n noTorrentsSelected: () => 'No torrents selected',\n\n noTorrentSelected: () => 'No torrent selected',\n\n noFilesSelected: () => 'No files selected',\n\n downloadStarted: () => 'Download started',\n\n chunkActionDone: ({ action }) => `${actionLabel(action)} done`,\n\n trackerActionDone: ({ action }) => `${actionLabel(action)} done`,\n\n pathPickerUnavailable: () => 'Path picker is unavailable',\n\n pathEmpty: () => 'Path is empty',\n\n columnsSaved: () => 'Columns saved',\n\n recommendedColumnsApplied: () => 'Recommended columns applied',\n\n jobLogsCleared: ({ deleted }) =>\n `Cleared ${deleted || 0} finished job log(s)`,\n\n emergencyJobLogsCleared: ({ deleted }) =>\n `Emergency cleanup removed ${deleted || 0} job log(s)`,\n\n rtorrentConfigSaved: ({ updated }) =>\n `rTorrent config saved (${updated || 0})`,\n\n rtorrentConfigReset: ({ removed }) =>\n `rTorrent config reset (${removed || 0} override(s) removed)`,\n\n automationLogsDeleted: ({ deleted }) =>\n `Automation logs deleted: ${deleted || 0}`,\n\n cleanupDone: ({ deleted }) => `Cleanup done (${deleted})`,\n\n plannerApplied: ({ dryRun, paused, resumed, limitsChanged }) =>\n `${dryRun ? 'Planner dry-run' : 'Planner applied'}: paused ${paused || 0}, resumed ${resumed || 0}, limits ${limitsChanged ? 'changed' : 'unchanged'}`,\n\n rssQueued: ({ queued }) => `RSS queued ${queued || 0} item(s)`,\n\n smartQueueCheckQueued: () =>\n 'Smart Queue check queued. It will continue in the background.',\n\n automationForceRunDone: ({ count }) =>\n `Automation force run done (${count || 0} torrent item(s))`,\n\n automationsApplied: ({ count, batches }) =>\n batches\n ? `Automations applied ${count || 0} torrent(s) in ${batches || 0} batch(es)`\n : `Automations applied ${count || 0} item(s)`,\n\n torrentStatsError: ({ error }) => `Torrent stats: ${error}`,\n\n startupConfigApplied: ({ count }) =>\n `Startup rTorrent config applied (${count || 0})`,\n\n startupConfigFailed: ({ error }) =>\n `Startup rTorrent config: ${error}`,\n\n plannerSocketResult: ({ paused, resumed, dryRun }) =>\n `Planner: paused ${paused || 0}, resumed ${resumed || 0}${dryRun ? ' dry-run' : ''}`\n }\n };\n\n function actionLabel(action) {\n const key = String(action || '').trim();\n\n if (APP_MESSAGES.actions[key]) {\n return APP_MESSAGES.actions[key];\n }\n\n return key\n ? key.replace(/[_-]+/g, ' ').replace(/\\\\b\\\\w/g, (c) => c.toUpperCase())\n : 'Operation';\n }\n\n function appMessage(key, params = {}) {\n const fn = key\n .split('.')\n .reduce((acc, part) => acc && acc[part], APP_MESSAGES);\n\n return typeof fn === 'function' ? fn(params) : String(fn || key);\n }\n\n function toastMessage(key, type = 'secondary', params = {}) {\n toast(appMessage(key, params), type);\n }\n";
|