Answer the question
In order to leave comments, you need to log in
How to implement a simple language change on the site?
My knowledge was not enough to solve the problem, and I could not find the answer in Google.
There is a business card site with a small number of html pages (~12-14 per version). "site.ru" (main) and "site.ru/en" (English).
You need to determine the user's language (by browser language) and redirect to the desired link. At the same time, the site has the ability to switch the language through the link. Once clicked, this state is written to the cookie.
Thanks for any help.
Answer the question
In order to leave comments, you need to log in
If pure html, then you can define it using JS:
<script type="text/javascript">
var userLang = navigator.language || navigator.userLanguage;
window.location = "https://my.site.ru/" + userLang;
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question