This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
forked from i18next/next-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
73 lines (66 loc) · 2.31 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useTranslation, Trans } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { Header } from '../components/Header'
import { Footer } from '../components/Footer'
const Homepage = () => {
const router = useRouter()
const { t } = useTranslation('common')
return (
<>
<main>
<Header heading={t('h1')} title={t('title')} />
<div style={{ display: 'inline-flex', width: '90%' }}>
<div style={{ width: '50%' }}>
<h3 style={{ minHeight: 70 }}>{t('blog.optimized.question')}</h3>
<p>
<Trans i18nKey='blog.optimized.answer'>
Then you may have a look at <a href='https://locize.com/blog/next-i18next/'>this blog post</a>.
</Trans>
</p>
<a href='https://locize.com/blog/next-i18next/'>
<img style={{ width: '50%' }} src='https://locize.com/blog/next-i18next/next-i18next.jpg' />
</a>
</div>
<div style={{ width: '50%' }}>
<h3 style={{ minHeight: 70 }}>{t('blog.ssg.question')}</h3>
<p>
<Trans i18nKey='blog.ssg.answer'>
Then you may have a look at <a href='https://locize.com/blog/next-i18n-static/'>this blog post</a>.
</Trans>
</p>
<a href='https://locize.com/blog/next-i18n-static/'>
<img style={{ width: '50%' }} src='https://locize.com/blog/next-i18n-static/title.jpg' />
</a>
</div>
</div>
<hr style={{ marginTop: 20, width: '90%' }} />
<div>
<Link
href='/'
locale={router.locale === 'en' ? 'de' : 'en'}
>
<button>
{t('change-locale', { changeTo: router.locale === 'en' ? 'de' : 'en' })}
</button>
</Link>
<Link href='/second-page'>
<button
type='button'
>
{t('to-second-page')}
</button>
</Link>
</div>
</main>
<Footer />
</>
)
}
export const getStaticProps = async ({ locale }) => ({
props: {
...await serverSideTranslations(locale, ['common', 'footer']),
},
})
export default Homepage