1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-14 22:50:15 +00:00

feat: add user display name field (#898)

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Kyle Mendell
2025-09-17 10:18:27 -05:00
committed by GitHub
parent 2d6d5df0e7
commit 68373604dd
32 changed files with 280 additions and 112 deletions

View File

@@ -1,8 +1,19 @@
import { setLocale as setParaglideLocale, type Locale } from '$lib/paraglide/runtime';
import {
extractLocaleFromCookie,
setLocale as setParaglideLocale,
type Locale
} from '$lib/paraglide/runtime';
import { setDefaultOptions } from 'date-fns';
import { z } from 'zod/v4';
export async function setLocale(locale: Locale, reload = true) {
await setLocaleForLibraries(locale);
setParaglideLocale(locale, { reload });
}
export async function setLocaleForLibraries(
locale: Locale = (extractLocaleFromCookie() as Locale) || 'en'
) {
const [zodResult, dateFnsResult] = await Promise.allSettled([
import(`../../../node_modules/zod/v4/locales/${locale}.js`),
import(`../../../node_modules/date-fns/locale/${locale}.js`)
@@ -14,8 +25,6 @@ export async function setLocale(locale: Locale, reload = true) {
console.warn(`Failed to load zod locale for ${locale}:`, zodResult.reason);
}
setParaglideLocale(locale, { reload });
if (dateFnsResult.status === 'fulfilled') {
setDefaultOptions({
locale: dateFnsResult.value.default