import Telescope from 'meteor/nova:lib'; import React, { PropTypes, Component } from 'react'; import { IntlProvider, intlShape} from 'react-intl'; class App extends Component { getLocale() { return Telescope.settings.get("locale", "en"); } getChildContext() { const messages = Telescope.strings[this.getLocale()] || {}; const intlProvider = new IntlProvider({locale: this.getLocale()}, messages); const {intl} = intlProvider.getChildContext(); return { currentUser: this.props.currentUser, categories: this.props.categories, actions: {call: Meteor.call}, events: this.props.events, intl: intl }; } render() { return ( { this.props.ready ? {this.props.children} : } ) } } App.propTypes = { ready: React.PropTypes.bool, currentUser: React.PropTypes.object, categories: React.PropTypes.array, actions: React.PropTypes.object, events: React.PropTypes.object, } App.childContextTypes = { currentUser: React.PropTypes.object, categories: React.PropTypes.array, actions: React.PropTypes.object, events: React.PropTypes.object, intl: intlShape, } module.exports = App; export default App;