remove bloat fonts, get rid of svelte-i18n
Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
22
app/src/routes/+layout.server.js
Normal file
22
app/src/routes/+layout.server.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { color } from "../lib/util.js";
|
||||
|
||||
export async function load({ cookies, request }) {
|
||||
// attempt get the preferred locale from cookies
|
||||
let locale = cookies.get("locale");
|
||||
|
||||
/* if that doesn't work, try the accept-language header, and update the
|
||||
* cookies respectively */
|
||||
if (!locale) {
|
||||
locale = request.headers.get("accept-language")?.split(",")[0];
|
||||
cookies.set("locale", locale, { path: "/" });
|
||||
}
|
||||
|
||||
return {
|
||||
// the locale we detected
|
||||
locale: locale,
|
||||
|
||||
/* color is randomly picked on the server and passed via data to the client
|
||||
* so both the client and the server will have the same color */
|
||||
color: color(),
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user