diff --git a/main.ts b/main.ts index cb335ef..45c4887 100644 --- a/main.ts +++ b/main.ts @@ -541,7 +541,12 @@ class ParallelReaderPlugin extends Plugin { new Notice(this.t('batchAlreadyRunning')); return; } - const folderPath = await promptForBatchFolder(this.app, this.t('batchSelectFolder'), this.t('batchFolderPrompt')); + const folderPath = await promptForBatchFolder( + this.app, + this.t('batchSelectFolder'), + this.t('batchFolderPrompt'), + this.t('batchFolderConfirm'), + ); if (folderPath === null) return; const validation = validateBatchFolderInput(folderPath, (path) => { const target = this.app.vault.getAbstractFileByPath(path); diff --git a/src/batch.ts b/src/batch.ts index 647053e..fdca8ed 100644 --- a/src/batch.ts +++ b/src/batch.ts @@ -104,7 +104,12 @@ export function requestBatchCancel(state: BatchRunState | null): boolean { return true; } -export function promptForBatchFolder(app: App, selectText: string, promptText: string): Promise { +export function promptForBatchFolder( + app: App, + selectText: string, + promptText: string, + confirmText: string, +): Promise { return new Promise((resolve) => { const modal = new Modal(app); modal.onOpen = () => { @@ -118,7 +123,7 @@ export function promptForBatchFolder(app: App, selectText: string, promptText: s modal.close(); } }); - modal.contentEl.createEl('button', { text: 'OK' }).addEventListener('click', () => { + modal.contentEl.createEl('button', { text: confirmText }).addEventListener('click', () => { resolve(input.value.trim()); modal.close(); }); diff --git a/src/i18n-strings.ts b/src/i18n-strings.ts index fd6d42c..546c838 100644 --- a/src/i18n-strings.ts +++ b/src/i18n-strings.ts @@ -158,6 +158,7 @@ export const STRINGS: Record> = { cmdBatchGenerate: '批量生成对照笔记(当前文件夹)', batchSelectFolder: '请输入要批量处理的文件夹路径(留空为 Vault 根目录)', batchFolderPrompt: '文件夹路径', + batchFolderConfirm: '确定', batchAlreadyRunning: '批量生成正在运行', batchCancelRequested: '已请求取消批量生成;当前文件结束后停止', batchInvalidFolderInput: '文件夹路径无效:{path}', @@ -332,6 +333,7 @@ export const STRINGS: Record> = { cmdBatchGenerate: 'Batch generate parallel notes (current folder)', batchSelectFolder: 'Enter the folder path to batch-process (leave blank for Vault root)', batchFolderPrompt: 'Folder path', + batchFolderConfirm: 'OK', batchAlreadyRunning: 'Batch generation is already running', batchCancelRequested: 'Batch cancellation requested; it will stop after the current note', batchInvalidFolderInput: 'Invalid folder path: {path}', diff --git a/tests/i18n.test.js b/tests/i18n.test.js index 2986eb6..68fb76c 100644 --- a/tests/i18n.test.js +++ b/tests/i18n.test.js @@ -31,5 +31,6 @@ assert.strictEqual( t.translate({ uiLanguage: 'en' }, 'confirmExportOverwrite', { path: 'Reading/A.md' }), 'Export file already exists: Reading/A.md\nOverwrite it?', ); +assert.strictEqual(t.translate({ uiLanguage: 'zh' }, 'batchFolderConfirm'), '确定'); console.log('i18n tests passed');