I'm creating a bilingual website for a client. Two versions of the site in different languages will be created and stored in two folders: /en/ /chi/
What I want to do is create a link to toggle between the two languages. On the conceptual level, I understand that Javascript can detect the current URL and split it into its different components, modify parts of it (in this case change between /en/ and /chi/), and then go to that new URL when the link is clicked.
But I have zero knowledge in javascript so I have no idea how to execute... I have come across this page: http://css-tricks.com/snippets/javascript/get-url-and-url-parts-in-javascript/ but it doesn't explain how to modify and go to the new link.
You help will be greatly appreciated!!