mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 17:20:24 +00:00
fix(i18n): use translated label for OK button in promptForBatchFolder
Adds okLabel parameter with 'OK' fallback; caller in main.ts passes
plugin.t('editCardSave') so button text respects UI language.
https://claude.ai/code/session_012cK5rUGQvqkuxUZ59x7dLn
This commit is contained in:
parent
69f255b656
commit
d81039611a
2 changed files with 13 additions and 3 deletions
7
main.ts
7
main.ts
|
|
@ -537,7 +537,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('editCardSave'),
|
||||
);
|
||||
if (folderPath === null) return;
|
||||
const validation = validateBatchFolderInput(folderPath, (path) => {
|
||||
const target = this.app.vault.getAbstractFileByPath(path);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,12 @@ export function requestBatchCancel(state: BatchRunState | null): boolean {
|
|||
return true;
|
||||
}
|
||||
|
||||
export function promptForBatchFolder(app: App, selectText: string, promptText: string): Promise<string | null> {
|
||||
export function promptForBatchFolder(
|
||||
app: App,
|
||||
selectText: string,
|
||||
promptText: string,
|
||||
okLabel = 'OK',
|
||||
): Promise<string | null> {
|
||||
return new Promise<string | null>((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: okLabel }).addEventListener('click', () => {
|
||||
resolve(input.value.trim());
|
||||
modal.close();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue