mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add i18n support
This commit is contained in:
@@ -1,15 +1,23 @@
|
||||
import { Head } from "$fresh/runtime.ts";
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import GlobalContext from "../components/GlobalContext.tsx";
|
||||
import Container from "../islands/Container.tsx";
|
||||
import { get_i18nmap, i18n_handle_request } from "../server/i18ns.ts";
|
||||
|
||||
export default function Index() {
|
||||
export const handler: Handlers<string> = {
|
||||
GET(req, ctx) {
|
||||
const re = i18n_handle_request(req);
|
||||
if (typeof re === "string") return ctx.render(re);
|
||||
return re;
|
||||
},
|
||||
};
|
||||
|
||||
export default function Index({ data }: PageProps<string>) {
|
||||
const i18n = get_i18nmap(data);
|
||||
return (
|
||||
<body>
|
||||
<GlobalContext>
|
||||
<Head>
|
||||
<title>EH Downloader</title>
|
||||
</Head>
|
||||
<Container />
|
||||
<Container i18n={i18n} />
|
||||
</GlobalContext>
|
||||
</body>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user