fix: try without loose locale pick
parent
4bc6d53a89
commit
5ed649c131
|
@ -28,7 +28,7 @@ function useClientLocale(locales: string[]) {
|
|||
if (typeof window !== "undefined") {
|
||||
// This is the only way I found to ensure the prefetched locale is used on first render
|
||||
// FIXME: Find a better way to pick the best matching locale from the browser
|
||||
return parser.pick(locales, window.navigator.language, { loose: true }) || window.navigator.language;
|
||||
return parser.pick(locales, window.navigator.language) || window.navigator.language;
|
||||
}
|
||||
// If the browser is not available, use English
|
||||
return "en";
|
||||
|
|
|
@ -14,9 +14,7 @@ export async function getLocaleFromRequest(
|
|||
if (session?.user?.locale) return session.user.locale;
|
||||
let preferredLocale: string | null | undefined;
|
||||
if (req.headers["accept-language"]) {
|
||||
preferredLocale = parser.pick(i18n.locales, req.headers["accept-language"], {
|
||||
loose: true,
|
||||
}) as Maybe<string>;
|
||||
preferredLocale = parser.pick(i18n.locales, req.headers["accept-language"]) as Maybe<string>;
|
||||
}
|
||||
return preferredLocale ?? i18n.defaultLocale;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export const i18nInputSchema = z.object({
|
|||
locale: z
|
||||
.string()
|
||||
.min(2)
|
||||
.transform((locale) => parser.pick<string>(i18n.locales, locale, { loose: true }) || locale),
|
||||
.transform((locale) => parser.pick<string>(i18n.locales, locale) || locale),
|
||||
CalComVersion: z.string(),
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue