Skip to content

Build your personal knowledge base with Trilium Notes

feat(ckeditor5): finish rebranding the snippet strings

Elian Doran3c26ab42f29d
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 320ae8dcbc..e10f1141fe 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -3567,7 +3567,6 @@
},
"text-editor": {
"ck": {
- "0-templates-found": "%0 templates found",
"admonition": "Admonition",
"align-text-to-the-center": "Align text to the center",
"align-text-to-the-left": "Align text to the left",
@@ -3658,8 +3657,8 @@
"mermaid-widget": "Mermaid widget",
"missing-definition": "(missing definition)",
"new-footnote": "New footnote",
- "no-templates-available": "No templates available.",
- "no-templates-were-found-matching-0": "No templates were found matching \"%0\".",
+ "no-text-snippets-available": "No text snippets available.",
+ "no-text-snippets-were-found-matching-0": "No text snippets were found matching \"%0\".",
"note": "Note",
"numbered-list": "Numbered list",
"outdent": "Outdent",
@@ -3674,7 +3673,8 @@
"split-view": "Split view",
"summary": "Summary",
"task-state": "Task state:",
- "template": "Template",
+ "text-snippet": "Text snippet",
+ "text-snippets-found-0": "Text snippets found: %0",
"tip": "Tip",
"title": "Title",
"to-do-list": "To-do list",
diff --git a/apps/client/src/translations/ro/translation.json b/apps/client/src/translations/ro/translation.json
index 1b53c53ef3..44d93b44b0 100644
--- a/apps/client/src/translations/ro/translation.json
+++ b/apps/client/src/translations/ro/translation.json
@@ -2707,8 +2707,12 @@
"insert-text-snippet": "Inserează fragment de text",
"keyboard-shortcut": "Scurtătură de la tastatură",
"link-preview": "Previzualizare link",
+ "no-text-snippets-available": "Nu există fragmente de text.",
+ "no-text-snippets-were-found-matching-0": "Nu s-a găsit niciun fragment de text care să corespundă „%0”.",
"note": "Notă",
"search-text-snippet": "Caută fragment de text",
+ "text-snippet": "Fragment de text",
+ "text-snippets-found-0": "Fragmente de text găsite: %0",
"tip": "Sfat",
"warning": "Avertisment"
},
diff --git a/packages/ckeditor5/src/plugins/snippets/snippets.spec.ts b/packages/ckeditor5/src/plugins/snippets/snippets.spec.ts
index 5441774661..d4a77c97b6 100644
--- a/packages/ckeditor5/src/plugins/snippets/snippets.spec.ts
+++ b/packages/ckeditor5/src/plugins/snippets/snippets.spec.ts
@@ -147,7 +147,7 @@ describe("SnippetsUI — insertTemplate dropdown", () => {
it("shows the not-found message when a query matches nothing", () => {
searchView.search("zzzznomatch");
- expect((searchView.element as HTMLElement).textContent).toContain("No templates were found matching");
+ expect((searchView.element as HTMLElement).textContent).toContain("No text snippets were found matching");
});
it("inserts the snippet when a row is chosen", () => {
@@ -181,7 +181,7 @@ describe("SnippetsUI — menu-bar entry", () => {
});
it("lists one entry per snippet and inserts on execute", () => {
- expect(menu.buttonView.label).toBe("Template");
+ expect(menu.buttonView.label).toBe("Text snippet");
expect(menuButtons()).toHaveLength(2);
const execute = vi.spyOn(editor, "execute");
@@ -196,7 +196,7 @@ describe("SnippetsUI — menu-bar entry", () => {
const items = menuButtons();
expect(items).toHaveLength(1);
const emptyButton = (items[0] as ListItemView).children.get(0) as { label?: string; isEnabled?: boolean };
- expect(emptyButton.label).toBe("No templates available.");
+ expect(emptyButton.label).toBe("No text snippets available.");
expect(emptyButton.isEnabled).toBe(false);
});
diff --git a/packages/ckeditor5/src/plugins/snippets/snippetsui.ts b/packages/ckeditor5/src/plugins/snippets/snippetsui.ts
index 438f7dc770..7ff23c8444 100644
--- a/packages/ckeditor5/src/plugins/snippets/snippetsui.ts
+++ b/packages/ckeditor5/src/plugins/snippets/snippetsui.ts
@@ -51,11 +51,11 @@ export default class SnippetsUI extends Plugin {
infoView: {
text: {
notFound: {
- primary: (query) => t("No templates were found matching \"%0\".", query as string),
+ primary: (query) => t("No text snippets were found matching \"%0\".", query as string),
secondary: t("Please try a different phrase or check the spelling.")
},
noSearchableItems: {
- primary: t("No templates available.")
+ primary: t("No text snippets available.")
}
}
}
@@ -63,7 +63,10 @@ export default class SnippetsUI extends Plugin {
searchView.on("search", (evt, data: { query: string; resultsCount: number }) => {
if (data.query.length) {
- editor.ui.ariaLiveAnnouncer.announce(t("%0 templates found", data.resultsCount));
+ // Phrased with the count last rather than as "%0 text snippets found", which
+ // would need a plural form: this is announced for every result count, one
+ // included, and the message dictionary has no plural handling.
+ editor.ui.ariaLiveAnnouncer.announce(t("Text snippets found: %0", data.resultsCount));
}
});
@@ -89,7 +92,7 @@ export default class SnippetsUI extends Plugin {
const command = editor.commands.get("insertTemplate") as Command;
const menuView = new MenuBarMenuView(locale);
menuView.buttonView.set({
- label: t("Template"),
+ label: t("Text snippet"),
icon: templateIcon
});
@@ -124,7 +127,7 @@ export default class SnippetsUI extends Plugin {
if (!definitions.length) {
const emptyItem = new MenuBarMenuListItemView(locale, menuView);
const emptyButton = new MenuBarMenuListItemButtonView(locale);
- emptyButton.set({ label: t("No templates available."), isEnabled: false });
+ emptyButton.set({ label: t("No text snippets available."), isEnabled: false });
emptyItem.children.add(emptyButton);
listView.items.add(emptyItem);
return;