Actually I know that I need to use COOKIES, but I do not know how to screw myself, I use these URLs: site.com/en/, Russian by default (without the prefix ru). Language files are connected automatically depending on en, ru, uk, de, by, and so on. You can find out the current language

App::getRouter()->getLanguage(); 

Well, depending on the language, write a cookie, and then check it when the user logs on. But if he has a cookie, how to redirect him to the same url, but to his language? In order to substitute the desired language to the url, for example, when the user changes the language and that he gets on the same page I have written such a function

 Lang::getLink(); // Например <a href="http://site.com<?=Lang::getLink('en')?>" 

as a result, if the user navigated from the page: site.com/category/article from the link above, then he gets to: site.com/en/category/article

I apologize if not clearly explained)

  • in the session write down everything - Naumov
  • What framework? - toxxxa 2:26 pm
  • @toxxxa, Samopiniy - Vadim Pedchenko
  • one
    header("Location: http://site.com/en/category/article/");exit; - AK
  • 2
    Where does perpetual redirect come from? Compare the language recorded in the cookie with the language of the current sub-site: matched - stop redirecting. Do not match - redirect. - AK

0