Page 1 of 1

Bi Language site

Posted: Fri Nov 10, 2017 5:58 pm
by ncveggm
Hi Dears
I design A web site with English and need to add Arabic language so

I make two folders with the same pages one for Arabic and one for English.
I make two buttons in header of master page to select language

So, How I can redirect the any current page to the same page in the other language or vise versa by use the same buttons in master page

I need an example to detect the current page and redirect it to the other page with the same name but in the other folder by use the same buttons for all pages in the site

as this site
https://www.mt.com/eg/ar/home.html
https://www.mt.com/eg/en/home.html

WHAT IS THE WRONG IN THIS CODE
window.location.href="http://MY URL/en/" + window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1);

thanks

Re: Bi Language site

Posted: Fri Nov 10, 2017 8:46 pm
by ncveggm
thanks

I correct the code and it is working with any page from master page

THE CORRECT CODE IS
window.location.href='http://www.MY URL.com/en/'+ window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1)