I need to make landing page on 2 languages, swapping language by click on the flag.
How I understand, I need to save language state in user's localstorage / cookies.
I see here 3 options:
Upload on user machine .json with content on 2 languages. At the opening of page script will check localstorage for availability of lang variable and after it fill page by JS.
Save lang variable in cookies, and at appeal to the server, server must make magic and send back page built on user language.
Make duplicates of each page in each language.
Question 1:
Which way better, when and why? (cases: one page landing, site with many pages)
Question 2:
When I make duplicates of page, is it normal to have no index.html
in root directory at all, but:
/en/index.html
/ru/index.html
and .htaccess
file that redirect to /en/
by default, check cookies for lang variable, and if exist redirect user to specific folder.