Bi Language site

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
ncveggm
 
 
Posts: 31
Joined: Mon Nov 06, 2017 12:14 am

Bi Language site

Post 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
Last edited by ncveggm on Fri Nov 10, 2017 6:57 pm, edited 1 time in total.
ncveggm
 
 
Posts: 31
Joined: Mon Nov 06, 2017 12:14 am

Re: Bi Language site

Post 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)
Post Reply