Skip to content

Commit 06a41d5

Browse files
committed
fix for the translations added language header
1 parent d553067 commit 06a41d5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/common/lang.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import React from 'react';
2+
import { render } from 'react-dom';
13
import { parseQueryString } from '../common/utils/tools';
2-
import { set as setStorage, get as getStorage } from '../common/utils/storageManager';
4+
import { set as setStorage, get as getStorage, remove } from '../common/utils/storageManager';
35
import { setCookieLanguage } from '../common/utils/cookieManager';
46
import { supportedLanguages, translate, init } from './i18n';
57
import { getClientsCountryByIP } from './utils/utility';
8+
import BotLanding from '../indexPage/react-components/bot-landing';
69

10+
const elements = ['#notification-banner', '#main', '#footer', '#header'];
711
export const getLanguage = () => {
812
const queryLang = parseQueryString().l;
913
const lang = queryLang in supportedLanguages ? queryLang : getStorage('lang') || 'en';
@@ -30,7 +34,17 @@ export const load = () => {
3034

3135
$('#select_language li:not(:first)').click(function click() {
3236
const newLang = $(this).attr('class');
33-
document.location.search = `l=${newLang}`;
37+
if (document.getElementById('bot-landing').classList.contains('hidden') === false) {
38+
remove('setDueDateForBanner');
39+
render(<BotLanding />, document.getElementById('bot-landing'));
40+
elements.map(elem => document.querySelector(elem).classList.add('hidden'));
41+
document.getElementById('bot-landing').classList.remove('hidden');
42+
document.getElementById('bot-main').classList.remove('hidden');
43+
$('.barspinner').hide();
44+
document.location.search = `l=${newLang}`;
45+
} else {
46+
document.location.search = `l=${newLang}`;
47+
}
3448
});
3549

3650
$('.language').text(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy