Skip to content

Commit

Permalink
Merge pull request #13813 from ethereum/fix-circular-dep-2
Browse files Browse the repository at this point in the history
Fix circular dep issue with `Translation` component
  • Loading branch information
pettinarip authored Sep 6, 2024
2 parents 76bddad + 3a48c35 commit 065a055
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/Translation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ type TranslationProps = {
transform?: HtmrOptions["transform"]
}

// Custom components mapping to be used by `htmr` when parsing the translation
// text
const defaultTransform = {
a: TooltipLink,
}

// Renders the translation string for the given translation key `id`. It
// fallback to English if it doesn't find the given key in the current language
const Translation = ({ id, options, transform = {} }: TranslationProps) => {
Expand All @@ -28,6 +22,12 @@ const Translation = ({ id, options, transform = {} }: TranslationProps) => {
const { t } = useTranslation(requiredNamespaces)
const translatedText = t(id, options)

// Custom components mapping to be used by `htmr` when parsing the translation
// text
const defaultTransform = {
a: TooltipLink,
}

// Use `htmr` to parse html content in the translation text
return htmr(translatedText, {
transform: { ...defaultTransform, ...transform },
Expand Down

0 comments on commit 065a055

Please sign in to comment.