communication-react-19
Version:
React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)
25 lines • 899 B
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import React, { createContext, useContext } from 'react';
import { COMPONENT_LOCALE_EN_US } from './locales';
/**
* Context for providing localized strings to components exported from this library.
*
* @public
*/
export const LocaleContext = createContext(COMPONENT_LOCALE_EN_US);
/**
* Provider to provide localized strings for this library's react components.
*
* @remarks Components will be provided localized strings in English (US) by default if this
* provider is not used.
*
* @public
*/
export const LocalizationProvider = (props) => {
const { locale, children } = props;
return React.createElement(LocaleContext.Provider, { value: locale }, children);
};
/** React hook to access locale */
export const useLocale = () => useContext(LocaleContext);
//# sourceMappingURL=LocalizationProvider.js.map