-
Notifications
You must be signed in to change notification settings - Fork 4
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
lijiahao
committed
Sep 24, 2024
1 parent
80c2dc1
commit 19599a9
Showing
20 changed files
with
178 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// @ts-check | ||
|
||
/** | ||
* @type {import('next-i18next').UserConfig} | ||
*/ | ||
|
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,32 @@ | ||
import {serverSideTranslations} from "next-i18next/serverSideTranslations" | ||
|
||
import i18next from "../../next-i18next.config.js" | ||
|
||
export function getI18nPaths() { | ||
return ["en", "zh"].map(locale => ({ | ||
params: { | ||
locale, | ||
}, | ||
})) | ||
} | ||
|
||
export function getStaticPaths() { | ||
return { | ||
fallback: false, paths: getI18nPaths(), | ||
} | ||
} | ||
|
||
export async function getI18nProperties(context, namespaces = ["common"]) { | ||
const locale = context?.params?.locale ?? i18next.i18n.defaultLocale; | ||
return { | ||
...(await serverSideTranslations(locale, namespaces)), | ||
} | ||
} | ||
|
||
export function makeStaticProperties(namespaces = []) { | ||
return async function (context) { | ||
return { | ||
props: await getI18nProperties(context, namespaces), | ||
}; | ||
}; | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
import React from "react"; | ||
import Head from "next/head"; | ||
import { getStaticPaths, makeStaticProperties } from "../../lib/get-static"; | ||
|
||
function Error404Page() { | ||
return ( | ||
<React.Fragment> | ||
<Head> | ||
<title>XStreaming - Error</title> | ||
</Head> | ||
|
||
<p>Oopsie 404.. Action not found</p> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default Error404Page; | ||
|
||
// eslint-disable-next-line react-refresh/only-export-components | ||
export const getStaticProps = makeStaticProperties(["common"]); | ||
|
||
// eslint-disable-next-line react-refresh/only-export-components | ||
export { getStaticPaths }; |
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,23 @@ | ||
import React from "react"; | ||
import Head from "next/head"; | ||
import { getStaticPaths, makeStaticProperties } from "../../lib/get-static"; | ||
|
||
function Error500Page() { | ||
return ( | ||
<React.Fragment> | ||
<Head> | ||
<title>XStreaming - Error</title> | ||
</Head> | ||
|
||
<p>Oopsie 500.. Application has an error</p> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default Error500Page; | ||
|
||
// eslint-disable-next-line react-refresh/only-export-components | ||
export const getStaticProps = makeStaticProperties(["common"]); | ||
|
||
// eslint-disable-next-line react-refresh/only-export-components | ||
export { getStaticPaths }; |
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
Oops, something went wrong.