-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(annotations): Send react-intl strings to annotations (#1174)
* feat(annotations): Send react-intl strings to annotations * Requires version upgrade of box-annotations * Add shim for Intl and Karma * Add resolver for lang files for annotations * Remove redundant tags from index.html in test directory
- Loading branch information
Showing
9 changed files
with
71 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import i18n from '../i18n'; | ||
|
||
describe('i18n', () => { | ||
it('should return an intl provider object', () => { | ||
const intl = i18n.createAnnotatorIntl(); | ||
expect(intl.messages).to.be.an('object'); | ||
expect(intl.language).to.equal('en-US'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// TODO @mickryan remove after we upgrade the annotations version | ||
let annotationMessages = {}; | ||
|
||
try { | ||
annotationMessages = require('box-annotations-messages').default; // eslint-disable-line | ||
} catch (e) {} // eslint-disable-line | ||
|
||
const language = __LANGUAGE__ || 'en-US'; // eslint-disable-line | ||
|
||
/** | ||
* Creates Intl object used by annotations | ||
* | ||
* @private | ||
* @return {Object} | ||
*/ | ||
const createAnnotatorIntl = () => { | ||
return { | ||
messages: annotationMessages, | ||
language, | ||
}; | ||
}; | ||
|
||
export default { createAnnotatorIntl }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters