11'use client' ;
22
3- import { useFormatter } from 'next-intl' ;
3+ import { useFormatter , useLocale , useTranslations } from 'next-intl' ;
44import type { FC } from 'react' ;
55
66import MetaBar from '@/components/Containers/MetaBar' ;
@@ -10,6 +10,8 @@ import WithAvatarGroup from '@/components/withAvatarGroup';
1010import { useClientContext } from '@/hooks/react-client' ;
1111import useMediaQuery from '@/hooks/react-client/useMediaQuery' ;
1212import { DEFAULT_DATE_FORMAT } from '@/next.calendar.constants.mjs' ;
13+ import { TRANSLATION_URL } from '@/next.constants.mjs' ;
14+ import { defaultLocale } from '@/next.locales.mjs' ;
1315import { getGitHubBlobUrl } from '@/util/gitHubUtils' ;
1416
1517const WithMetaBar : FC = ( ) => {
@@ -22,6 +24,9 @@ const WithMetaBar: FC = () => {
2224 const usernames =
2325 frontmatter . authors ?. split ( ',' ) . map ( author => author . trim ( ) ) ?? [ ] ;
2426
27+ const t = useTranslations ( ) ;
28+ const locale = useLocale ( ) ;
29+
2530 // Since we cannot show the same number of avatars in Mobile / Tablet
2631 // resolution as we do on desktop and there is overflow, we are adjusting
2732 // the number of avatars manually for the resolutions below
@@ -47,7 +52,15 @@ const WithMetaBar: FC = () => {
4752 'components.metabar.contribute' : (
4853 < >
4954 < GitHub className = "fill-neutral-700 dark:fill-neutral-100" />
50- < Link href = { getGitHubBlobUrl ( filename ) } > Edit this page</ Link >
55+ < Link
56+ href = {
57+ locale === defaultLocale . code
58+ ? getGitHubBlobUrl ( filename )
59+ : TRANSLATION_URL
60+ }
61+ >
62+ { t ( 'components.metabar.contributeText' ) }
63+ </ Link >
5164 </ >
5265 ) ,
5366 } }
0 commit comments