diff --git a/lang/ui.ca.json b/lang/ui.ca.json index 3a9487ea8..d50f2c671 100644 --- a/lang/ui.ca.json +++ b/lang/ui.ca.json @@ -211,6 +211,10 @@ "defaultMessage": "Copia el programa", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Crea", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.de.json b/lang/ui.de.json index acf49b770..66d4f7ce3 100644 --- a/lang/ui.de.json +++ b/lang/ui.de.json @@ -211,6 +211,10 @@ "defaultMessage": "Code kopieren", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Erstellen", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.en.json b/lang/ui.en.json index 74d3435be..585c00b02 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -211,6 +211,10 @@ "defaultMessage": "Copy code", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Toast shown when you copy from API or Reference snippets" + }, "create-action": { "defaultMessage": "Create", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.es-es.json b/lang/ui.es-es.json index 014cc6e0f..676a49aeb 100644 --- a/lang/ui.es-es.json +++ b/lang/ui.es-es.json @@ -211,6 +211,10 @@ "defaultMessage": "Copiar código", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Crea", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.fr.json b/lang/ui.fr.json index 7f19e35a5..543092461 100644 --- a/lang/ui.fr.json +++ b/lang/ui.fr.json @@ -211,6 +211,10 @@ "defaultMessage": "Copier le code", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Créez", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.ja.json b/lang/ui.ja.json index a34af86c4..b15552a01 100644 --- a/lang/ui.ja.json +++ b/lang/ui.ja.json @@ -211,6 +211,10 @@ "defaultMessage": "コードをコピー", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "作る", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.ko.json b/lang/ui.ko.json index 60e38c574..9fce902ac 100644 --- a/lang/ui.ko.json +++ b/lang/ui.ko.json @@ -211,6 +211,10 @@ "defaultMessage": "코드 복사", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Create", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.lol.json b/lang/ui.lol.json index d8273f769..812dd3ded 100644 --- a/lang/ui.lol.json +++ b/lang/ui.lol.json @@ -211,6 +211,10 @@ "defaultMessage": "crwdns331458:0crwdne331458:0", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "crwdns331460:0crwdne331460:0", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.nl.json b/lang/ui.nl.json index bb038b593..f62bf91e9 100644 --- a/lang/ui.nl.json +++ b/lang/ui.nl.json @@ -211,6 +211,10 @@ "defaultMessage": "Kopieer code", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Maak", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.pl.json b/lang/ui.pl.json index fa63abcfd..11c0cfa59 100644 --- a/lang/ui.pl.json +++ b/lang/ui.pl.json @@ -211,6 +211,10 @@ "defaultMessage": "Skopiuj kod", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "Twórz", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.zh-cn.json b/lang/ui.zh-cn.json index 79dd4b8b2..71f0b05a8 100644 --- a/lang/ui.zh-cn.json +++ b/lang/ui.zh-cn.json @@ -211,6 +211,10 @@ "defaultMessage": "复制代码", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "创作", "description": "Create action label (e.g. in create file dialog)" diff --git a/lang/ui.zh-tw.json b/lang/ui.zh-tw.json index f535f926b..ba5cc8d11 100644 --- a/lang/ui.zh-tw.json +++ b/lang/ui.zh-tw.json @@ -211,6 +211,10 @@ "defaultMessage": "複製程式碼", "description": "Copy code to clipboard action text" }, + "copy-snippet-advice": { + "defaultMessage": "Code copied, use paste to insert it.", + "description": "Copy code to clipboard action text" + }, "create-action": { "defaultMessage": "創造", "description": "Create action label (e.g. in create file dialog)" diff --git a/src/editor/active-editor-hooks.tsx b/src/editor/active-editor-hooks.tsx index 9d1ed3c37..0a6297692 100644 --- a/src/editor/active-editor-hooks.tsx +++ b/src/editor/active-editor-hooks.tsx @@ -18,6 +18,7 @@ import { ActionFeedback } from "../common/use-action-feedback"; import { Logging } from "../logging/logging"; import { copyCodeSnippet } from "./codemirror/copypaste"; import { CodeInsertType } from "./codemirror/dnd"; +import { IntlShape } from "react-intl"; /** * Actions that operate on a CM editor. @@ -26,7 +27,8 @@ export class EditorActions { constructor( private view: EditorView, private logging: Logging, - private actionFeedback: ActionFeedback + private actionFeedback: ActionFeedback, + private intl: IntlShape ) {} copyCode = async ( @@ -46,7 +48,7 @@ export class EditorActions { id, }); this.actionFeedback.success({ - title: "Code copied, use paste to insert it.", + title: this.intl.formatMessage({ id: "copy-snippet-advice" }), }); }; undo = (): void => { diff --git a/src/editor/codemirror/CodeMirror.tsx b/src/editor/codemirror/CodeMirror.tsx index 05ec97999..e2aa339a6 100644 --- a/src/editor/codemirror/CodeMirror.tsx +++ b/src/editor/codemirror/CodeMirror.tsx @@ -167,7 +167,7 @@ const CodeMirror = ({ }); viewRef.current = view; - setActiveEditor(new EditorActions(view, logging, actionFeedback)); + setActiveEditor(new EditorActions(view, logging, actionFeedback, intl)); } }, [ actionFeedback, diff --git a/src/messages/ui.ca.json b/src/messages/ui.ca.json index 412ba39c3..aa2392b77 100644 --- a/src/messages/ui.ca.json +++ b/src/messages/ui.ca.json @@ -435,6 +435,12 @@ "value": "Copia el programa" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.de.json b/src/messages/ui.de.json index 5c9993429..4a226ded7 100644 --- a/src/messages/ui.de.json +++ b/src/messages/ui.de.json @@ -471,6 +471,12 @@ "value": "Code kopieren" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.en.json b/src/messages/ui.en.json index e8c6af7c6..3471dbc26 100644 --- a/src/messages/ui.en.json +++ b/src/messages/ui.en.json @@ -431,6 +431,12 @@ "value": "Copy code" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.es-es.json b/src/messages/ui.es-es.json index e7db558b1..7cabeb680 100644 --- a/src/messages/ui.es-es.json +++ b/src/messages/ui.es-es.json @@ -435,6 +435,12 @@ "value": "Copiar código" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.fr.json b/src/messages/ui.fr.json index 571adf9c3..9e674cff8 100644 --- a/src/messages/ui.fr.json +++ b/src/messages/ui.fr.json @@ -431,6 +431,12 @@ "value": "Copier le code" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.ja.json b/src/messages/ui.ja.json index 255841006..9dde023d5 100644 --- a/src/messages/ui.ja.json +++ b/src/messages/ui.ja.json @@ -455,6 +455,12 @@ "value": "コードをコピー" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.ko.json b/src/messages/ui.ko.json index 3b7ecf280..3637bb5e7 100644 --- a/src/messages/ui.ko.json +++ b/src/messages/ui.ko.json @@ -439,6 +439,12 @@ "value": "코드 복사" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.lol.json b/src/messages/ui.lol.json index 9e1d87cde..b5d049eee 100644 --- a/src/messages/ui.lol.json +++ b/src/messages/ui.lol.json @@ -421,6 +421,12 @@ "value": "crwdns331458:0crwdne331458:0" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.nl.json b/src/messages/ui.nl.json index 131d320be..be4bbd7bd 100644 --- a/src/messages/ui.nl.json +++ b/src/messages/ui.nl.json @@ -443,6 +443,12 @@ "value": "Kopieer code" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.pl.json b/src/messages/ui.pl.json index 970886b53..485e2ff47 100644 --- a/src/messages/ui.pl.json +++ b/src/messages/ui.pl.json @@ -447,6 +447,12 @@ "value": "Skopiuj kod" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.zh-cn.json b/src/messages/ui.zh-cn.json index e1c3725f8..b158d6eb1 100644 --- a/src/messages/ui.zh-cn.json +++ b/src/messages/ui.zh-cn.json @@ -431,6 +431,12 @@ "value": "复制代码" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0, diff --git a/src/messages/ui.zh-tw.json b/src/messages/ui.zh-tw.json index 6d815f889..e1fdc916d 100644 --- a/src/messages/ui.zh-tw.json +++ b/src/messages/ui.zh-tw.json @@ -427,6 +427,12 @@ "value": "複製程式碼" } ], + "copy-snippet-advice": [ + { + "type": 0, + "value": "Code copied, use paste to insert it." + } + ], "create-action": [ { "type": 0,