summaryrefslogtreecommitdiffstats
path: root/web/react/pages/login.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-21 13:54:21 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-21 13:54:21 -0600
commitdea84b1892be42e8d42db8b67862b56b38c0da75 (patch)
tree2427c16e886a29870b685a90ea7e5173a217875d /web/react/pages/login.jsx
parentff9bcce42d14c3b26baf2dab2a1574a3848ea93b (diff)
downloadchat-dea84b1892be42e8d42db8b67862b56b38c0da75.tar.gz
chat-dea84b1892be42e8d42db8b67862b56b38c0da75.tar.bz2
chat-dea84b1892be42e8d42db8b67862b56b38c0da75.zip
PLT-7 Adding react-intl libs
Diffstat (limited to 'web/react/pages/login.jsx')
-rw-r--r--web/react/pages/login.jsx70
1 files changed, 62 insertions, 8 deletions
diff --git a/web/react/pages/login.jsx b/web/react/pages/login.jsx
index 4a565623e..edf2d4f66 100644
--- a/web/react/pages/login.jsx
+++ b/web/react/pages/login.jsx
@@ -1,17 +1,71 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
+import * as Client from '../utils/client.jsx';
import Login from '../components/login.jsx';
-function setupLoginPage(props) {
+var IntlProvider = ReactIntl.IntlProvider;
+ReactIntl.addLocaleData(ReactIntlLocaleData.en);
+ReactIntl.addLocaleData(ReactIntlLocaleData.es);
+
+class Root extends React.Component {
+ constructor() {
+ super();
+ this.state = {
+ translations: null,
+ loaded: false
+ };
+ }
+
+ static propTypes() {
+ return {
+ map: React.PropTypes.object.isRequired
+ };
+ }
+
+ componentWillMount() {
+ Client.getTranslations(
+ 'es',
+ (data) => {
+ this.setState({
+ translations: data,
+ loaded: true
+ });
+ },
+ () => {
+ this.setState({
+ loaded: true
+ });
+ }
+ );
+ }
+
+ render() {
+ if (!this.state.loaded) {
+ return <div></div>;
+ }
+
+ return (
+ <IntlProvider
+ locale='es'
+ messages={this.state.translations}
+ >
+ <Login
+ teamDisplayName={this.props.map.TeamDisplayName}
+ teamName={this.props.map.TeamName}
+ inviteId={this.props.map.InviteId}
+ />
+ </IntlProvider>
+ );
+ }
+}
+
+global.window.setup_login_page = function setup(props) {
ReactDOM.render(
- <Login
- teamDisplayName={props.TeamDisplayName}
- teamName={props.TeamName}
- inviteId={props.InviteId}
- />,
+ <Root map={props} />,
document.getElementById('login')
);
-}
+};
+
-global.window.setup_login_page = setupLoginPage;
+//locale={this.props.map.Locale} \ No newline at end of file