functional i18n
This commit is contained in:
parent
af743859ce
commit
5c8075adca
1 changed files with 15 additions and 1 deletions
16
pages/faq.js
16
pages/faq.js
|
@ -1,8 +1,11 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
import { Header } from '../component/header';
|
import { Header } from '../component/header';
|
||||||
import { Email } from '../component/email';
|
import { Email } from '../component/email';
|
||||||
import md from '../faq.md';
|
import md from '../faq.md';
|
||||||
|
import { t, m } from '../i18n';
|
||||||
|
import { tracker } from '../analytics';
|
||||||
|
|
||||||
function flatten(text, child) {
|
function flatten(text, child) {
|
||||||
return typeof child === 'string'
|
return typeof child === 'string'
|
||||||
|
@ -18,6 +21,17 @@ function HeadingRenderer(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Faq() {
|
export default function Faq() {
|
||||||
|
const router = useRouter();
|
||||||
|
const lang = router.query.lang || 'en';
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
tracker.trackPageView();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
function __(message) {
|
||||||
|
return t(message, lang);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Header faqPage />
|
<Header faqPage />
|
||||||
|
@ -29,7 +43,7 @@ export default function Faq() {
|
||||||
</ReactMarkdown>
|
</ReactMarkdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Email />
|
<Email i18n={__} />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue