I have a website that has the following language switching algorithm:
- First, it detects the default browser language (I do not know why? but Chrome always gives something like
en-EN,ru,lv
, so Chrome's default language always is English, it seems). - Then it writes the language value into a session variable
lang
and requests the desired string file (i.e./assets/includes/en-US/strings.php
); - And every string from this file is being included in the HTML code, so the pure HTML has not any plain text in.
Of course, a default language detection is not the reason to stop - I need a manual language switcher like links (LV | EN | RU). So, what id the possible (and maybe the best) way to switch the language and to overwrite the session variable after user clicks to the desired language?