Skip to content

Build your personal knowledge base with Trilium Notes

markdown editor/slash commands: localize some strings

Adorian Doran42a7a91b4f84
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index b3489da40d..d40bd91161 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -269,7 +269,12 @@
"collapsible": "Insert a collapsible block",
"admonition": "Insert {{type}} admonition",
"todo": "Insert a \"{{title}}\" task item",
- "todo_nonstandard": "Insert a \"{{title}}\" task item (non-standard)"
+ "todo_nonstandard": "Insert a \"{{title}}\" task item (non-standard)",
+ "placeholders": {
+ "math": "equation",
+ "collapsible_summary": "Summary",
+ "collapsible_details": "Details"
+ }
},
"slash_commands": {
"bulleted_list_description": "Create a bulleted list",
diff --git a/apps/client/src/widgets/type_widgets/code/Markdown.tsx b/apps/client/src/widgets/type_widgets/code/Markdown.tsx
index f3f3680457..b170e388d4 100644
--- a/apps/client/src/widgets/type_widgets/code/Markdown.tsx
+++ b/apps/client/src/widgets/type_widgets/code/Markdown.tsx
@@ -573,7 +573,7 @@ function useSlashCommands(parentComponent: TypeWidgetProps["parentComponent"], e
label: "/math",
detail: t("markdown_slash_commands.math"),
apply(view, _completion, from, to) {
- const placeholder = "\\text{equation}";
+ const placeholder = `\\text{${t("markdown_slash_commands.placeholders.math")}}`;
const template = `$$\n${placeholder}\n$$`;
view.dispatch({
changes: { from, to, insert: template },
@@ -635,9 +635,9 @@ function useSlashCommands(parentComponent: TypeWidgetProps["parentComponent"], e
apply(view, _completion, from, to) {
// No native markdown syntax — round-trips through the
// importer as raw <details>/<summary> HTML (see markdown.ts).
- const placeholder = "Summary";
+ const placeholder = t("markdown_slash_commands.placeholders.collapsible_summary");
const open = `<details class="trilium-collapsible">\n<summary>`;
- const close = `</summary>\n\nDetails\n\n</details>`;
+ const close = `</summary>\n\n${t("markdown_slash_commands.placeholders.collapsible_details")}\n\n</details>`;
const anchor = from + open.length;
view.dispatch({
changes: { from, to, insert: open + placeholder + close },