@@ -9,7 +9,7 @@ import i18next from 'i18next';
99import * as IDEActions from '../modules/IDE/actions/ide' ;
1010import * as toastActions from '../modules/IDE/actions/toast' ;
1111import * as projectActions from '../modules/IDE/actions/project' ;
12- import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences' ;
12+ import { setAllAccessibleOutput , setLanguage } from '../modules/IDE/actions/preferences' ;
1313import { logoutUser } from '../modules/User/actions' ;
1414
1515import getConfig from '../utils/getConfig' ;
@@ -72,7 +72,6 @@ class Nav extends React.PureComponent {
7272 document . removeEventListener ( 'mousedown' , this . handleClick , false ) ;
7373 document . removeEventListener ( 'keydown' , this . closeDropDown , false ) ;
7474 }
75-
7675 setDropdown ( dropdown ) {
7776 this . setState ( {
7877 dropdownOpen : dropdown
@@ -170,7 +169,7 @@ class Nav extends React.PureComponent {
170169 }
171170
172171 handleLangSelection ( event ) {
173- i18next . changeLanguage ( event . target . value ) ;
172+ this . props . setLanguage ( event . target . value ) ;
174173 this . props . showToast ( 1500 ) ;
175174 this . props . setToastText ( 'Toast.LangChange' ) ;
176175 this . setDropdown ( 'none' ) ;
@@ -808,8 +807,8 @@ Nav.propTypes = {
808807 params : PropTypes . shape ( {
809808 username : PropTypes . string
810809 } ) ,
811- t : PropTypes . func . isRequired
812-
810+ t : PropTypes . func . isRequired ,
811+ setLanguage : PropTypes . func . isRequired ,
813812} ;
814813
815814Nav . defaultProps = {
@@ -839,7 +838,8 @@ const mapDispatchToProps = {
839838 ...projectActions ,
840839 ...toastActions ,
841840 logoutUser,
842- setAllAccessibleOutput
841+ setAllAccessibleOutput,
842+ setLanguage
843843} ;
844844
845845export default withTranslation ( ) ( withRouter ( connect ( mapStateToProps , mapDispatchToProps ) ( Nav ) ) ) ;
0 commit comments