diff --git a/src/lib/__tests__/i18n-test.js b/src/lib/__tests__/i18n-test.js index ff85fb7d1..20e6cd60e 100644 --- a/src/lib/__tests__/i18n-test.js +++ b/src/lib/__tests__/i18n-test.js @@ -1,11 +1,9 @@ -import { IntlProvider } from 'react-intl'; import i18n from '../i18n'; describe('i18n', () => { it('should return an intl provider object', () => { const intl = i18n.createAnnotatorIntl(); - expect(intl.provider).to.be.an.instanceof(IntlProvider); + expect(intl.messages).to.be.an('object'); expect(intl.language).to.equal('en-US'); - expect(intl.intlLocaleData).to.be.an('array'); }); }); diff --git a/src/lib/i18n.js b/src/lib/i18n.js index c9700dab1..7d8bba8e8 100644 --- a/src/lib/i18n.js +++ b/src/lib/i18n.js @@ -1,14 +1,9 @@ -import { IntlProvider, addLocaleData } from 'react-intl'; -import intlLocaleData from 'react-intl-locale-data'; // eslint-disable-line - // TODO @mickryan remove after we upgrade the annotations version -let annotationMessages; +let annotationMessages = {}; try { - annotationMessages = require('box-annotations-messages'); // eslint-disable-line -} catch (e) { - annotationMessages = {}; -} + annotationMessages = require('box-annotations-messages').default; // eslint-disable-line +} catch (e) {} // eslint-disable-line const language = __LANGUAGE__ || 'en-US'; // eslint-disable-line @@ -19,17 +14,9 @@ const language = __LANGUAGE__ || 'en-US'; // eslint-disable-line * @return {Object} */ const createAnnotatorIntl = () => { - addLocaleData(intlLocaleData); return { - intlLocaleData, + messages: annotationMessages, language, - provider: new IntlProvider( - { - locale: language.substr(0, language.indexOf('-')), - messages: annotationMessages, - }, - {}, - ), }; }; diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index 8488c26e6..e873ee887 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -1,6 +1,5 @@ /* eslint-disable no-unused-expressions */ import EventEmitter from 'events'; -import { IntlProvider } from 'react-intl'; import BaseViewer from '../BaseViewer'; import Browser from '../../Browser'; import RepStatus from '../../RepStatus'; @@ -1386,9 +1385,8 @@ describe('lib/viewers/BaseViewer', () => { expect(combinedOptions.location).to.deep.equal({ locale: 'en-US' }); expect(combinedOptions.randomOption).to.equal('derp'); expect(combinedOptions.localizedStrings).to.not.be.undefined; - expect(combinedOptions.intl.provider).to.be.an.instanceof(IntlProvider); expect(combinedOptions.intl.language).to.equal('en-US'); - expect(combinedOptions.intl.intlLocaleData).to.be.an('array'); + expect(combinedOptions.intl.messages).to.be.an('object'); }); });