import { NextIntlClientProvider } from 'next-intl'
import { getMessages } from 'next-intl/server'
import { type ComponentProps } from 'react'

type LangProviderProps = ComponentProps<typeof NextIntlClientProvider>

export async function LangProvider({ children, ...props }: LangProviderProps) {
	const messages = await getMessages()

	return (
		<NextIntlClientProvider messages={messages} {...props}>
			{children}
		</NextIntlClientProvider>
	)
}
