From 98cd4a09b4edd5e73107573e6cf075a4bb7a1cba Mon Sep 17 00:00:00 2001 From: Leilei332 Date: Tue, 27 Aug 2024 16:26:42 +0800 Subject: [PATCH] Make the default title created by excision translatable (#8500) * Make the default title created by excision translatable * Use $tw.language.getString to get language string --- core/language/en-GB/Buttons.multids | 1 + core/modules/editor/operations/text/excise.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 30f89eec7..2fa732fd9 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -133,6 +133,7 @@ Excise/Caption/Replace/Link: link Excise/Caption/Replace/Transclusion: transclusion Excise/Caption/Tag: Tag new tiddler with the title of this tiddler Excise/Caption/TiddlerExists: Warning: tiddler already exists +Excise/DefaultTitle: New Excision Excise/Hint: Excise the selected text into a new tiddler Heading1/Caption: heading 1 Heading1/Hint: Apply heading level 1 formatting to lines containing selection diff --git a/core/modules/editor/operations/text/excise.js b/core/modules/editor/operations/text/excise.js index ced771719..8cb3a8486 100644 --- a/core/modules/editor/operations/text/excise.js +++ b/core/modules/editor/operations/text/excise.js @@ -14,11 +14,12 @@ Text editor operation to excise the selection to a new tiddler exports["excise"] = function(event,operation) { var editTiddler = this.wiki.getTiddler(this.editTitle), - editTiddlerTitle = this.editTitle; + editTiddlerTitle = this.editTitle, + excisionBaseTitle = $tw.language.getString("Buttons/Excise/DefaultTitle"); if(editTiddler && editTiddler.fields["draft.of"]) { editTiddlerTitle = editTiddler.fields["draft.of"]; } - var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle("New Excision"); + var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle(excisionBaseTitle); this.wiki.addTiddler(new $tw.Tiddler( this.wiki.getCreationFields(), this.wiki.getModificationFields(),