Initial commit: fristy.net personal site
This commit is contained in:
51 files changed
+6033
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { DEFAULT_LOCALE, LOCALE_COOKIE, isLocale, type Locale } from "./locales";
|
||||
|
||||
export async function getLocale(): Promise<Locale> {
|
||||
const store = await cookies();
|
||||
const raw = store.get(LOCALE_COOKIE)?.value;
|
||||
if (raw && isLocale(raw)) {
|
||||
return raw;
|
||||
}
|
||||
return DEFAULT_LOCALE;
|
||||
}
|
||||
Reference in new issue
Block a user