Merged in fix/BOOK-399-default-language (pull request #2877)
fix(BOOK-399): Default language to 'en' when we've ended up in a invalid state * fix(BOOK-399): Default language to 'en' when we've ended up in a invalid state * PR fixes: reuse types and include local dev error message Approved-by: Anton Gunnarsson Approved-by: Linus Flood
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
"use client"
|
||||
|
||||
import { IntlProvider } from "react-intl"
|
||||
import { type IntlConfig, IntlProvider } from "react-intl"
|
||||
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
|
||||
import type { ClientIntlProviderProps } from "@/types/i18n"
|
||||
|
||||
const logged: Record<string, boolean> = {}
|
||||
|
||||
export type ClientIntlProviderProps = React.PropsWithChildren<
|
||||
Pick<IntlConfig, "defaultLocale" | "messages"> & { locale: Lang }
|
||||
>
|
||||
|
||||
export default function ClientIntlProvider({
|
||||
children,
|
||||
locale,
|
||||
defaultLocale,
|
||||
messages,
|
||||
}: ClientIntlProviderProps) {
|
||||
if (!Lang[locale]) {
|
||||
locale = Lang.en
|
||||
}
|
||||
|
||||
return (
|
||||
<IntlProvider
|
||||
locale={locale}
|
||||
|
||||
Reference in New Issue
Block a user