Is there any way to access the current locale with React-Intl?

New answer – using hooks (see below for original)

import { useIntl } from 'react-intl';

const MyComponent: FC = () => {
    const intl = useIntl()
    return <div>{`Current locale: ${intl.locale}`}</div>

export default MyComponent

Old answer

You can get the current locale in any component of your App by simply accessing it from React Intl’s “injection API”:

import {injectIntl, intlShape} from 'react-intl';

const propTypes = {
  intl: intlShape.isRequired,

const MyComponent = ({intl}) => (
  <div>{`Current locale: ${intl.locale}`}</div>

MyComponent.propTypes = propTypes

export default injectIntl(MyComponent);

Leave a Comment