Multi language site / Multi Language (Automatic country detection without permission) [duplicate]

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 stackoverflow also uses.

How to do it?

In this way I identify the country and translate automatically.

pt.domain.com

or From this the site automatically translates for the user's location without changing the extension on the site.

domain.com 

Is there any way to do the multi-lang process by .htaccess ?

    
asked by anonymous 27.10.2016 / 12:24

1 answer

0

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

The best way to detect the user's language would be to Accept-Language , which takes the person's preferred browser language, for example, I prefer English, so most of the sites I go to redirect to the American version ( in-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, 'pt.domain.com', 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:

mysite.com/en-US/index.php,
mysite.com/en-in/index.php,

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

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

I hope I have helped.

    
27.10.2016 / 19:03