Skip to content

Commit

Permalink
fix(translations): init app translations
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed May 17, 2018
1 parent 87f23e7 commit 8cd1309
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,19 @@ window.peers = 0;
window.peersTorrents = 0;

class App extends Component {
componentDidMount() {
window.router()
appReady = true;
constructor(props)
{
super(props)
window.torrentSocket.emit('config', (config) => {
window.initConfig = config
changeLanguage(config.language, () => {
if(appReady)
this.forceUpdate()
})
});
}

componentDidMount() {
window.torrentSocket.on('peer', (peer) => {
if(peer.size > window.peers)
window.peersTorrents = (window.peersTorrents || 0) + peer.torrents
Expand Down Expand Up @@ -137,11 +146,17 @@ class App extends Component {
window.torrentSocket.on('changeLanguage', (lang) => {
changeLanguage(lang, () => this.forceUpdate())
})

window.router()
appReady = true;
}
componentWillUnmount() {
appReady = false;
}
render() {
if(!window.initConfig)
return null // nothing to do yet

return (
<MuiThemeProvider>
<div>
Expand Down

0 comments on commit 8cd1309

Please sign in to comment.