1
1
'use client' ;
2
2
3
- import { useFormatter } from 'next-intl' ;
3
+ import { useFormatter , useLocale , useTranslations } from 'next-intl' ;
4
4
import type { FC } from 'react' ;
5
5
6
6
import MetaBar from '@/components/Containers/MetaBar' ;
@@ -10,6 +10,8 @@ import WithAvatarGroup from '@/components/withAvatarGroup';
10
10
import { useClientContext } from '@/hooks/react-client' ;
11
11
import useMediaQuery from '@/hooks/react-client/useMediaQuery' ;
12
12
import { DEFAULT_DATE_FORMAT } from '@/next.calendar.constants.mjs' ;
13
+ import { TRANSLATION_URL } from '@/next.constants.mjs' ;
14
+ import { defaultLocale } from '@/next.locales.mjs' ;
13
15
import { getGitHubBlobUrl } from '@/util/gitHubUtils' ;
14
16
15
17
const WithMetaBar : FC = ( ) => {
@@ -22,6 +24,9 @@ const WithMetaBar: FC = () => {
22
24
const usernames =
23
25
frontmatter . authors ?. split ( ',' ) . map ( author => author . trim ( ) ) ?? [ ] ;
24
26
27
+ const t = useTranslations ( ) ;
28
+ const locale = useLocale ( ) ;
29
+
25
30
// Since we cannot show the same number of avatars in Mobile / Tablet
26
31
// resolution as we do on desktop and there is overflow, we are adjusting
27
32
// the number of avatars manually for the resolutions below
@@ -47,7 +52,15 @@ const WithMetaBar: FC = () => {
47
52
'components.metabar.contribute' : (
48
53
< >
49
54
< 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 >
51
64
</ >
52
65
) ,
53
66
} }
0 commit comments