-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Link from 'next/link' | ||
|
||
import { useTranslation } from 'next-i18next' | ||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations' | ||
|
||
import { Header } from '../components/Header' | ||
import { Footer } from '../components/Footer' | ||
import { useEffect } from 'react' | ||
|
||
const LazyReloadPage = () => { | ||
|
||
const { t, i18n } = useTranslation(['lazy-reload-page', 'footer'], { bindI18n: 'languageChanged loaded' }) | ||
// bindI18n: loaded is needed because of the reloadResources call | ||
// if all pages use the reloadResources mechanism, the bindI18n option can also be defined in next-i18next.config.js | ||
useEffect(() => { | ||
i18n.reloadResources(i18n.resolvedLanguage, ['lazy-reload-page', 'footer']) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<main> | ||
<Header heading={t('h1')} title={t('title')} /> | ||
<Link href='/'> | ||
<button | ||
type='button' | ||
> | ||
{t('back-to-home')} | ||
</button> | ||
</Link> | ||
</main> | ||
<Footer /> | ||
</> | ||
) | ||
} | ||
|
||
export const getStaticProps = async ({ locale }) => ({ | ||
props: { | ||
...await serverSideTranslations(locale, ['lazy-reload-page', 'footer']), | ||
}, | ||
}) | ||
|
||
export default LazyReloadPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"h1": "Eine Seite, die Übersetzungsressourcen über http aktualisiert nachlädt", | ||
"back-to-home": "Zurück zur Hauptseite", | ||
"title": "Lazy Reload-Seite | next-i18next" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"h1": "A page that lazy realoads translation resources via http", | ||
"back-to-home": "Back to home", | ||
"title": "Lazy reload page | next-i18next" | ||
} |