diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-29 19:03:59 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-29 19:03:59 +0100 |
| commit | 8fb5e4ef3ae925ebc6622711fb5c8c6147642cbc (patch) | |
| tree | 9e99137a7b64ea7993a8311a7162336a551be8b2 /src/components/MDX/CodeBlock/CodeBlock.tsx | |
| parent | 2bae7c43764df5678fe2fc2e68be11ae95d85a41 (diff) | |
| parent | e4d5b8151802517b2943756fc0d09ffa95e2c4e2 (diff) | |
feat(i18n): replace linguijs with formatjs
Diffstat (limited to 'src/components/MDX/CodeBlock/CodeBlock.tsx')
| -rw-r--r-- | src/components/MDX/CodeBlock/CodeBlock.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/components/MDX/CodeBlock/CodeBlock.tsx b/src/components/MDX/CodeBlock/CodeBlock.tsx index ef8b587..59386af 100644 --- a/src/components/MDX/CodeBlock/CodeBlock.tsx +++ b/src/components/MDX/CodeBlock/CodeBlock.tsx @@ -3,6 +3,7 @@ import { translateCopyButton } from '@utils/helpers/prism'; import { useRouter } from 'next/router'; import Prism from 'prismjs'; import { ReactChildren, useEffect } from 'react'; +import { useIntl } from 'react-intl'; const CodeBlock = ({ className, @@ -15,6 +16,7 @@ const CodeBlock = ({ const languageClass = classNames.find((name: string) => name.startsWith('language-') ); + const intl = useIntl(); const router = useRouter(); const locale = router.locale ? router.locale : config.locales.defaultLocale; @@ -23,8 +25,8 @@ const CodeBlock = ({ }); useEffect(() => { - translateCopyButton(locale); - }, [locale]); + translateCopyButton(locale, intl); + }, [intl, locale]); return ( <div> |
