From 01c06394c1217ec0c546ef379366f94300bd308a Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:38:00 +1000 Subject: [PATCH] Internationalise tooltip --- ui/v2.5/src/components/Shared/TagLink.tsx | 24 ++++++++++++------- .../Tags/TagDetails/TagDetailsPanel.tsx | 2 ++ ui/v2.5/src/locales/en-GB.json | 2 ++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ui/v2.5/src/components/Shared/TagLink.tsx b/ui/v2.5/src/components/Shared/TagLink.tsx index 21086b15b85..2af75a8ae11 100644 --- a/ui/v2.5/src/components/Shared/TagLink.tsx +++ b/ui/v2.5/src/components/Shared/TagLink.tsx @@ -12,6 +12,7 @@ import { markerTitle } from "src/core/markers"; import { Placement } from "react-bootstrap/esm/Overlay"; import { faFolderTree } from "@fortawesome/free-solid-svg-icons"; import { Icon } from "../Shared/Icon"; +import { FormattedMessage } from "react-intl"; type SceneMarkerFragment = Pick & { scene: Pick; @@ -191,6 +192,7 @@ interface ITagLinkProps { className?: string; hoverPlacement?: Placement; showHierarchyIcon?: boolean; + hierarchyTooltipID?: string; } export const TagLink: React.FC = ({ @@ -199,6 +201,7 @@ export const TagLink: React.FC = ({ className, hoverPlacement, showHierarchyIcon = false, + hierarchyTooltipID, }) => { const link = useMemo(() => { switch (linkType) { @@ -217,20 +220,25 @@ export const TagLink: React.FC = ({ const title = tag.name || ""; + const tooltip = useMemo(() => { + if (!hierarchyTooltipID) { + return <>; + } + + return ( + + + + ); + }, [hierarchyTooltipID]); + return ( {title} {showHierarchyIcon && ( - - Explore tag hierarchy - - } - > + | diff --git a/ui/v2.5/src/components/Tags/TagDetails/TagDetailsPanel.tsx b/ui/v2.5/src/components/Tags/TagDetails/TagDetailsPanel.tsx index f17ccd6ec9f..9e368aa8b87 100644 --- a/ui/v2.5/src/components/Tags/TagDetails/TagDetailsPanel.tsx +++ b/ui/v2.5/src/components/Tags/TagDetails/TagDetailsPanel.tsx @@ -23,6 +23,7 @@ export const TagDetailsPanel: React.FC = ({ tag, fullWidth }) => { hoverPlacement="bottom" linkType="details" showHierarchyIcon={p.parent_count !== 0} + hierarchyTooltipID="tag_parent_tooltip" /> ))} @@ -43,6 +44,7 @@ export const TagDetailsPanel: React.FC = ({ tag, fullWidth }) => { hoverPlacement="bottom" linkType="details" showHierarchyIcon={c.child_count !== 0} + hierarchyTooltipID="tag_sub_tag_tooltip" /> ))} diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index 76c6be33c14..a911ad14e8c 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -1319,6 +1319,8 @@ "synopsis": "Synopsis", "tag": "Tag", "tag_count": "Tag Count", + "tag_parent_tooltip": "Has parent tags", + "tag_sub_tag_tooltip": "Has sub-tags", "tags": "Tags", "tattoos": "Tattoos", "title": "Title",