mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-13 19:30:30 +00:00
26 lines
531 B
JavaScript
26 lines
531 B
JavaScript
import React, { createContext } from 'react';
|
|
|
|
const AppIntlContext = createContext();
|
|
|
|
/**
|
|
* Application intl provider.
|
|
*/
|
|
function AppIntlProvider({ currentLocale, isRTL, children }) {
|
|
const provider = {
|
|
currentLocale,
|
|
isRTL,
|
|
isLTR: !isRTL,
|
|
direction: isRTL ? 'rtl' : 'ltr',
|
|
};
|
|
|
|
return (
|
|
<AppIntlContext.Provider value={provider}>
|
|
{children}
|
|
</AppIntlContext.Provider>
|
|
);
|
|
}
|
|
|
|
const useAppIntlContext = () => React.useContext(AppIntlContext);
|
|
|
|
export { AppIntlProvider, useAppIntlContext };
|