Skip to content

Add getInitOptions() function

Compare
Choose a tag to compare
@cwtuan cwtuan released this 27 Nov 15:42
· 231 commits to master since this release
de671f4

Some developers would like to get the initial options such as currentLocale at some other files. Here you are.

FileA.js

import intl from 'react-intl-universal';
intl.init({ locales, currentLocale: "en-US" });

FileB.js

import intl from 'react-intl-universal';
const { currentLocale } = intl.getInitOptions();
console.log(currentLocale); // "en-US"