1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-react-i18next/components/LanguageSwitch.js

23 lines
501 B
JavaScript

import React from 'react'
import Link from 'next/link'
import { withRouter } from 'next/router'
import i18n from '../i18n'
const LanguageSwitch = ({ router }) => (
<ul>
<li>
<Link href={`${router.pathname}`}>
<a onClick={() => i18n.changeLanguage('en')}>en</a>
</Link>
</li>
<li>
<Link href={`${router.pathname}?lng=de`}>
<a onClick={() => i18n.changeLanguage('de')}>de</a>
</Link>
</li>
</ul>
)
export default withRouter(LanguageSwitch)