import React , { createContext , useContext } from 'react' ; import { ComponentLocale , LocalizationProvider as ComponentLocalizationProvider } from '@internal/react-components' ; import { COMPOSITE_LOCALE_EN_US } from './locales' ; import { CallCompositeStrings } from '../CallComposite' ; import { ChatCompositeStrings } from '../ChatComposite' ; import { MeetingCompositeStrings } from '../MeetingComposite/Strings' ; public export interface CompositeLocale { /** Strings used in composites directly
     *
     * Contrast with  CompositeLocale . component , which contains strings used via the component library.
      strings : CompositeStrings ; /** Locale information for the pure Components used by Composites. See  communication-react .  component : ComponentLocale ; } public export interface CompositeStrings { /**
     * Strings used by  CallComposite .
      call : CallCompositeStrings ; /**
     * Strings used by  ChatComposite .
      chat : ChatCompositeStrings ; /**
     * Strings used by  MeetingComptosite .
      meeting : MeetingCompositeStrings ; } private export const LocaleContext = createContext < CompositeLocale > ( COMPOSITE_LOCALE_EN_US ) ; private export type LocalizationProviderProps = { /** Locale context to provide components */ locale : CompositeLocale ; /** Children to provide locale context. */ children : React . ReactNode ; } ; private export const LocalizationProvider = ( props ) : JSX . Element => { const { locale , children } = props ; return ( < LocaleContext . Provider value = { locale } > < ComponentLocalizationProvider locale = { locale . component } > { children } < /ComponentLocalizationProvider> < /LocaleContext.Provider>); } ; private export const useLocale = ( ) : CompositeLocale => useContext ( LocaleContext ) ;