mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-28 19:54:50 +02:00
Added basic i18n
This commit is contained in:
+20
-18
@@ -1,20 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="%sveltekit.assets%/favicon-192.png" />
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="%sveltekit.assets%/favicon-192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="%sveltekit.assets%/favicon-512.png" />
|
||||
<link rel="mask-icon" href="%sveltekit.assets%/safari-pinned-tab.svg" color="#1A1B4D" />
|
||||
<meta name="msapplication-TileColor" color="#1A1B4D" />
|
||||
<link rel="manifest" href="%sveltekit.assets%/site.webmanifest" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<html lang="%lang%">
|
||||
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="%sveltekit.assets%/favicon-192.png" />
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="%sveltekit.assets%/favicon-192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="%sveltekit.assets%/favicon-512.png" />
|
||||
<link rel="mask-icon" href="%sveltekit.assets%/safari-pinned-tab.svg" color="#1A1B4D" />
|
||||
<meta name="msapplication-TileColor" color="#1A1B4D" />
|
||||
<link rel="manifest" href="%sveltekit.assets%/site.webmanifest" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+18
-4
@@ -1,13 +1,21 @@
|
||||
import { logger } from "$lib/logger";
|
||||
import type { Handle } from "@sveltejs/kit";
|
||||
import { sequence } from "@sveltejs/kit/hooks";
|
||||
import { paraglideMiddleware } from "./i18n/server";
|
||||
import { corsHandle } from "./server-hooks/corsHandle";
|
||||
import { loggingHandle } from "./server-hooks/loggingHandle";
|
||||
import { rateLimitHandle } from "./server-hooks/rateLimitHandle";
|
||||
import { secHeaderHandle } from "./server-hooks/secHeaderHandle";
|
||||
|
||||
type Error = {
|
||||
message?: string;
|
||||
stack?: string;
|
||||
const i18nHandler: Handle = ({ event, resolve }) => {
|
||||
return paraglideMiddleware(event.request, ({ request: localizedRequest, locale }) => {
|
||||
event.request = localizedRequest;
|
||||
return resolve(event, {
|
||||
transformPageChunk: ({ html }) => {
|
||||
return html.replace("%lang%", locale);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export async function handleError({ error, event, status, message }) {
|
||||
@@ -29,4 +37,10 @@ export async function handleError({ error, event, status, message }) {
|
||||
};
|
||||
}
|
||||
|
||||
export const handle = sequence(loggingHandle, rateLimitHandle, corsHandle, secHeaderHandle);
|
||||
export const handle = sequence(
|
||||
loggingHandle,
|
||||
i18nHandler,
|
||||
rateLimitHandle,
|
||||
corsHandle,
|
||||
secHeaderHandle
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { cn, type WithElementRef } from "$lib/utils.js";
|
||||
import HorizontalPagePadding from "./horizontal-page-padding.svelte";
|
||||
import { Text } from "../typography";
|
||||
import { m } from "$i18n/messages";
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
@@ -21,7 +22,7 @@
|
||||
<footer>
|
||||
<HorizontalPagePadding class="bg-muted text-muted-foreground py-2 text-center">
|
||||
<Text style="xs">
|
||||
Powered by
|
||||
{m.poweredBy()}
|
||||
<a href="https://open-reception.org" target="_blank" class="underline">OpenReception</a>
|
||||
</Text>
|
||||
</HorizontalPagePadding>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const prerender = true;
|
||||
@@ -2,6 +2,7 @@
|
||||
import { HorizontalPagePadding, PageWithClaim } from "$lib/components/ui/page";
|
||||
import { Headline, Text } from "$lib/components/ui/typography";
|
||||
import { toggleMode } from "mode-watcher";
|
||||
import { m } from "$i18n/messages";
|
||||
|
||||
export let data;
|
||||
</script>
|
||||
@@ -13,7 +14,7 @@
|
||||
<PageWithClaim>
|
||||
<main>
|
||||
<HorizontalPagePadding class="flex flex-col items-start gap-4">
|
||||
<Headline level="h1" style="h1">Welcome to OpenReception</Headline>
|
||||
<Headline level="h1" style="h1">{m.welcome()}</Headline>
|
||||
<Text style="md">
|
||||
Environment configuration is
|
||||
{#await data.streamed.isEnvOk}
|
||||
|
||||
Reference in New Issue
Block a user