website/src/routes/__layout.svelte

60 lines
1.4 KiB
Svelte
Raw Normal View History

<script context="module">
2022-06-22 12:27:47 +05:30
import { locale, loadTranslations } from "$lib/translations";
2022-06-22 12:27:47 +05:30
export const load = async ({ url }) => {
const { pathname } = url;
2022-06-22 12:27:47 +05:30
const defaultLocale = "en"; // get from cookie, user session, ...
2022-06-22 12:27:47 +05:30
const initLocale = locale.get() || defaultLocale; // set default if no locale already set
2022-06-22 12:27:47 +05:30
await loadTranslations(initLocale, pathname); // keep this just before the `return`
2022-06-22 12:27:47 +05:30
// firefox
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language
// chrome
// https://developer.chrome.com/extensions/i18n#overview-getAcceptLanguages
// edge
// https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
2022-06-22 04:31:35 +05:30
2022-06-22 12:27:47 +05:30
return {};
};
</script>
2022-06-22 12:27:47 +05:30
<script>
import "$lib/app.css";
import Nav from "$lib/Nav.svelte";
import Footer from "$lib/Footer.svelte";
import SvelteSeo from "svelte-seo";
import Banner from "$lib/images/ProjectSegfault_Desktop_16-9.png";
import * as global from "../i18n/_global.json";
import { t } from "$lib/translations";
</script>
<SvelteSeo
2022-06-25 16:54:41 +05:30
title="{global.NAME}"
description="{$t("common.INDEX_DESCRIPTION")}"
canonical="https://projectsegfau.lt/"
2022-06-22 12:27:47 +05:30
openGraph={{
2022-06-25 16:54:41 +05:30
url: "https://projectsegfau.lt/",
2022-06-22 12:27:47 +05:30
title: global.NAME,
description: $t("common.INDEX_DESCRIPTION"),
images: [
{
url: Banner,
width: 850,
height: 650,
2022-06-25 16:54:41 +05:30
alt: "Our banner"
2022-06-22 12:27:47 +05:30
}
]
}}
/>
<Nav />
2022-06-22 12:27:47 +05:30
2022-02-28 23:42:33 +05:30
<main>
<slot />
</main>
2022-06-22 12:27:47 +05:30
<Footer />