S
S
semki0962019-04-16 13:55:47
Internationalization and localization
semki096, 2019-04-16 13:55:47

Why do you need to specify the language in the address bar in a multilingual site if it can be taken from the session?

Why, for example toster.ru/ru/node, specify the language in the address bar, if you can take the client's language from the session?
Here's what I'm doing so far. I determine the language by the client's browser

$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);

Next, I check if there is a given language in my model, if there is, I write it to the session. If not, I set it to default. The question is - can I do without the language in the address bar, and can it be fraught with what? I will be grateful for advice.
$_SESSION['lang'] = $lang;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
antimind, 2019-04-16
@semki096

At least so that you can follow the link to get to the desired language.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question