import { getLocaleOnServer } from '@/i18n-config/server';
import React from 'react';
import { ToastProvider } from './base/toast';
import I18n from './i18n';

export type II18NServerProps = {
  children: React.ReactNode;
};

const I18NServer = async ({ children }: II18NServerProps) => {
  const locale = await getLocaleOnServer();

  return (
    <I18n {...{ locale }}>
      <ToastProvider>{children}</ToastProvider>
    </I18n>
  );
};

export default I18NServer;
