diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 25595b95b6..7184420945 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -313,6 +313,7 @@ Trilium provides powerful user scripting capabilities: - Translation files in `apps/client/src/translations/` - Use translation system via `t()` function - Automatic pluralization: Add `_other` suffix to translation keys (e.g., `item` and `item_other` for singular/plural) +- When a translated string contains **interpolated components** (e.g. links, note references) whose order may vary across languages, use `` from `react-i18next` instead of `t()`. This lets translators reorder components freely (e.g. `" in "` vs `"in , "`) ## Testing Conventions diff --git a/CLAUDE.md b/CLAUDE.md index b0573cea0c..a135324789 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -120,6 +120,7 @@ Trilium provides powerful user scripting capabilities: - Supported languages: English, German, Spanish, French, Romanian, Chinese - **Only add new translation keys to `en/translation.json`** — translations for other languages are managed via Weblate and will be contributed by the community - Third-party components (e.g., mind-map context menu) should use i18next `t()` for their labels, with the English strings added to `en/translation.json` under a dedicated namespace (e.g., `"mind-map"`) +- When a translated string contains **interpolated components** (e.g. links, note references) whose order may vary across languages, use `` from `react-i18next` instead of `t()`. This lets translators reorder components freely (e.g. `" in "` vs `"in , "`) ### Security Considerations - Per-note encryption with granular protected sessions diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index ba62c449da..867e041b27 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2323,7 +2323,7 @@ "get_child_notes": "Get child notes", "get_subtree": "Get subtree", "load_skill": "Load skill", - "in_parent": "in" + "note_in_parent": " in " } } } diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx index 0a424f89f4..6d806dff38 100644 --- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx +++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx @@ -3,6 +3,7 @@ import "./LlmChat.css"; import { Marked } from "marked"; import { useMemo } from "preact/hooks"; +import { Trans } from "react-i18next"; import { t } from "../../../services/i18n.js"; import utils from "../../../services/utils.js"; import { NewNoteLink } from "../../react/NoteLink.js"; @@ -79,12 +80,16 @@ function ToolCallCard({ toolCall }: { toolCall: ToolCall }) { {t(`llm.tools.${toolCall.toolName}`, { defaultValue: toolCall.toolName })} {refNoteId && ( - - {refParentId && ( - <> - {" "}{t("llm.tools.in_parent")}{" "} - - + {refParentId ? ( + , + Parent: + } as any} + /> + ) : ( + )} )}