A
A
Aleks_ja2013-04-02 22:09:20
Internationalization and localization
Aleks_ja, 2013-04-02 22:09:20

Properly organized language selection for the site

How to properly organize the choice of language for the user?

There is a site that is in Russian by default, but there is support for other languages. This is how mysite.com

opens by default . English version - mysite.com/en/ But what if an English-speaking person came? Now the Russian version of the site is being shown, and somewhere in the corner there is a language switcher. Is there any common practice? If you redirect somewhere immediately depending on the person’s language, then immediately the questions are how to determine the language (country ip vs setting in the browser), and how to redirect so that everything is ok with the search engines?



Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
dshvechikov, 2013-04-02
@dshvechikov

I think it’s more logical to check if the browser language, for example, is among the supported languages, then display it, if not, then English as international

G
gro, 2013-04-03
@gro

We have this:
1. All language versions of the catalogs.
2. From the root redirect to the language version.
3. Determine the language by IP + Accept-Language.
4. If the user switches the language, it is stored in cookies. Next time, redirect from the root to the selected language.
There were no problems with the search engines.

A
Alexey Sundukov, 2013-04-03
@alekciy

Set the language based on the Accept-Language header from the client. If there is no language supported by the site, then the default language is displayed. This is for the first login. After the user himself has explicitly chosen the desired language, we write it in cookies and use it for repeated logins.

M
max_rip, 2013-04-02
@max_rip

I think it's still better to make a pop-up, with a choice of language. And show it if the browser locale differs from the selected site language, and show it only once.

X
xsash, 2013-04-02
@xsash

Based on IP
I don’t claim to be the author of the ideal code, I did this on one project: pastebin.com/9peMcj2y
In the geo folder (base from maxmind.com)
geoip.dat geoip.inc geoipregionvars.php

E
egorinsk, 2013-04-03
@egorinsk

It's not very polite to silently redirect. It is much better, if an English user visits a Russian page for the first time, to show a large beautiful plate at the top with a suggestion to read the site in their native language.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question