fix: catch edge case of lang in path (#40826)
Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
22f017caa2
commit
77158a533e
@ -7,12 +7,12 @@ const createLanguageRedirect = ({ clientLocale, lang }) => {
|
|||||||
.filter(item => (item !== clientLocale && item !== lang ? item : ''))
|
.filter(item => (item !== clientLocale && item !== lang ? item : ''))
|
||||||
.join('/');
|
.join('/');
|
||||||
|
|
||||||
const domain = window?.location?.host
|
const hostTail = window?.location?.host
|
||||||
.split('.')
|
.split('.')
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.join('.');
|
.join('.');
|
||||||
const nextClient = lang !== 'chinese' ? 'www' : 'chinese';
|
const nextClient = lang !== 'chinese' ? 'www' : 'chinese';
|
||||||
const nextLocation = `${window?.location?.protocol}//${nextClient}.${domain}`;
|
const nextLocation = `${window?.location?.protocol}//${nextClient}.${hostTail}`;
|
||||||
|
|
||||||
if (lang === 'english' || lang === 'chinese')
|
if (lang === 'english' || lang === 'chinese')
|
||||||
return `${nextLocation}/${path}`;
|
return `${nextLocation}/${path}`;
|
||||||
|
Reference in New Issue
Block a user