diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-03 15:32:01 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-03 15:32:01 +0100 |
| commit | d76e7c054e51471c908707634f5dbdcd3422b8d9 (patch) | |
| tree | 6d74a0cdc8c21df22fbbaf087c56ed4e07a905ce /src/components/Layouts | |
| parent | f9276790f55bd9d528512e6fe647774b67860dd0 (diff) | |
chore: add line numbers to all prism blocks and translate copy button
Diffstat (limited to 'src/components/Layouts')
| -rw-r--r-- | src/components/Layouts/Layout.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index d3c13ad..a4d1d28 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -6,6 +6,9 @@ import Main from '@components/Main/Main'; import Breadcrumb from '@components/Breadcrumb/Breadcrumb'; import { t } from '@lingui/macro'; import 'prism-themes/themes/prism-coldark-cold.min.css'; +import { addPrismClasses, translateCopyButton } from '@utils/helpers/prism'; +import { useRouter } from 'next/router'; +import { config } from '@config/website'; const Layout = ({ children, @@ -14,9 +17,17 @@ const Layout = ({ children: ReactNode; isHome?: boolean; }) => { + const router = useRouter(); + const locale = router.locale ? router.locale : config.defaultLocale; + useEffect(() => { + addPrismClasses(); Prism.highlightAll(); - }, []); + }); + + useEffect(() => { + translateCopyButton(locale); + }, [locale]); return ( <> |
