mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
55 lines
No EOL
1.3 KiB
JavaScript
55 lines
No EOL
1.3 KiB
JavaScript
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,
|
|
actions: {call: Meteor.call},
|
|
events: this.props.events,
|
|
intl: intl
|
|
};
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<IntlProvider locale={this.getLocale()} messages={Telescope.strings[this.getLocale()]}>
|
|
{
|
|
this.props.loading ?
|
|
<Telescope.components.AppLoading /> :
|
|
<Telescope.components.Layout>{this.props.children}</Telescope.components.Layout>
|
|
}
|
|
</IntlProvider>
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
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,
|
|
}
|
|
|
|
module.exports = App;
|
|
export default App; |