Multi Language Site / Multi Language (Automatic Country Detection without Permission)

Asked

Viewed 692 times

1

I have a small project and would like to create a multi language system for the site. I found several forms here on the site, but I did not see any with this example, which including stackoverflow also uses.

How to do?

This way I identify the country and translating automatically.

pt.domain.com

or This site automatically translates by the user’s location without changing the extension on the site.

domain.com 

Has some way to do the multi-lang process by .htaccess?

1 answer

0

Your question has already been asked here at Stackoverflow and several of them already answer you how to do what you want, or rather none of them really tell you how to do it, just give you the possibilities, because there is no best way, It depends a lot on how you drive/develop your website/webapp.

The best way to detect the user’s language would be by Accept-Language, that takes the preferred language of the person’s browser, I for example, prefer English, so most of the sites that I enter, it redirects me to the American version (en-US).

With just this link below you can already find your answers.
How to make a multilingual site and identify the country of origin?

Some use what you want to know, the 'pt.domain.com', it is nothing more than a subdomain, but believe me, there is nothing "automatic" translation, but only the detection of the user’s language and then it is up to them to decide how they will translate, examples:

meusite.com/en-US/index.php,
meusite.com/en-BR/index.php,

Or translations of menus and etc saved in the database and then when the language is detected, the translation is searched in the database and returned.

Or as you saw, a subdomain containing the same system, only translated.

I hope I helped.

  • At first I will use this method, even though I find it a bit simple and foresee a supposed mistake later. But it helped A LOT! Thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.