import React from 'react'; import { Modal, Button, Nav, NavItem } from 'react-bootstrap'; import { Fa } from '../../components'; import { app } from '../../core/app'; export default class LanguageSel extends React.Component { constructor(props) { super(props); this.close = this.close.bind(this); } componentWillMount() { const self = this; const handler = app.add(evt => { if (evt === 'change-lang') { self.setState({ show: true }); } }); this.state = { handler: handler }; } shouldComponentUpdate(np, newState) { return !!newState.show; } componentWillUnmount() { app.remove(this.state.handler); } close() { this.setState({ show: null }); this.forceUpdate(); } changeLang(lang) { return () => { app.setLang(lang.id); }; } render() { if (!this.state.show) { return null; } const langs = app.getState().app.languages; const sellang = app.getLang(); return ( {__('changelang')} ); } } LanguageSel.propTypes = { };