File tree Expand file tree Collapse file tree 1 file changed +20
-12
lines changed
Expand file tree Collapse file tree 1 file changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -48,18 +48,26 @@ if (localStorage.getItem('Language')) {
4848 }
4949}
5050
51- if ( window . location . pathname == `${ prepathname } /en` && Language === 'en' ) {
52- window . location . pathname = window . location . pathname = `${ prepathname } /` ;
53- } else if ( Language === 'ru' && ! window . location . pathname == `${ prepathname } /ru` ) {
54- window . location . pathname = `${ prepathname } /ru` ;
51+ const LangCheck = ( ) => {
52+ if ( window . location . pathname == `${ prepathname } /en` && Language === 'en' ) {
53+ window . location . pathname = window . location . pathname = `${ prepathname } /` ;
54+ } else if ( Language === 'ru' && ! window . location . pathname == `${ prepathname } /ru` ) {
55+ window . location . pathname = `${ prepathname } /ru` ;
56+ }
5557}
5658
57- document . getElementById ( 'l-en' ) . addEventListener ( 'click' , function ( ) {
58- Language = 'en' ;
59- localStorage . setItem ( 'Language' , Language ) ;
60- } ) ;
59+ setTimeout ( ( ) => LangCheck , 10 )
6160
62- document . getElementById ( 'l-ru' ) . addEventListener ( 'click' , function ( ) {
63- Language = 'ru' ;
64- localStorage . setItem ( 'Language' , Language ) ;
65- } ) ;
61+ setTimeout ( ( ) => {
62+ document . getElementById ( 'l-en' ) . addEventListener ( 'click' , function ( ) {
63+ Language = 'en' ;
64+ localStorage . setItem ( 'Language' , Language ) ;
65+ LangCheck ( ) ;
66+ } ) ;
67+
68+ document . getElementById ( 'l-ru' ) . addEventListener ( 'click' , function ( ) {
69+ Language = 'ru' ;
70+ localStorage . setItem ( 'Language' , Language ) ;
71+ LangCheck ( ) ;
72+ } ) ;
73+ } , 100 ) ;
You can’t perform that action at this time.
0 commit comments