Fallback to next app default language (en) when user didn't specify locale. (#16425)
This commit is contained in:
@@ -4,7 +4,7 @@ import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { localeOptions } from "@calcom/lib/i18n";
|
||||
import { defaultLocaleOption, localeOptions } from "@calcom/lib/i18n";
|
||||
import { nameOfDay } from "@calcom/lib/weekday";
|
||||
import {
|
||||
Avatar,
|
||||
@@ -76,7 +76,7 @@ export const UserForm = ({
|
||||
{ value: "GOOGLE", label: "GOOGLE" },
|
||||
{ value: "SAML", label: "SAML" },
|
||||
];
|
||||
const defaultLocale = defaultValues?.locale || localeOptions[0].value;
|
||||
const defaultLocale = defaultValues?.locale || defaultLocaleOption.value;
|
||||
|
||||
const form = useForm<FormValues>({
|
||||
defaultValues: {
|
||||
|
||||
@@ -8,3 +8,7 @@ export const localeOptions = locales.map((locale) => ({
|
||||
value: locale,
|
||||
label: new Intl.DisplayNames(locale, { type: "language" }).of(locale) || "",
|
||||
}));
|
||||
|
||||
export const defaultLocaleOption = localeOptions.find(
|
||||
(locale) => locale.value === i18n.defaultLocale
|
||||
) as (typeof localeOptions)[number];
|
||||
|
||||
Reference in New Issue
Block a user