import Telescope from 'meteor/nova:lib'; import React, { PropTypes, Component } from 'react'; import { IntlProvider, intlShape} from 'react-intl'; import Events from "meteor/nova:events"; import { withApp } from 'meteor/nova:base-containers'; 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, actions: {call: Meteor.call}, events: Events, intl: intl }; } render() { return ( { this.props.loading ? : {this.props.children} } ) } } App.propTypes = { loading: React.PropTypes.bool, currentUser: React.PropTypes.object, actions: React.PropTypes.object, events: React.PropTypes.object, } App.childContextTypes = { currentUser: React.PropTypes.object, actions: React.PropTypes.object, events: React.PropTypes.object, intl: intlShape, } Telescope.registerComponent('App', App, withApp);