Is there a way to parse HTTP_USER_AGENT to get the current language of the user?
Try:
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); echo $lang;
You might want to try HTTP_ACCEPT_LANGUAGE in the super _ global file $ _SERVER.
See http://php.net/manual/en/reserved.variables.server.php for more information.
This will return a value like "en-us", which can then be broken down as needed.
User Agent, Accept-Language, , , !
Accept-Language
Another common way (how to create an alternative) for this is to check the user's IP address in relation to the IP address database with the corresponding regions. The most common database for this is GeoIP ( http://www.maxmind.com ). It’s worth a look if you are interested. Then you can move on to changing the language in the region.
Regards,Dennis M.
Source: https://habr.com/ru/post/1754886/More articles:Does the xmpp resource change? - xmppjQuery: notice of visible html elements - jqueryDocumenting php code is the best way to document a group includes or requires phpThree problems TTLauncher - objective-cCallback after completing a job delayed_job - ruby | fooobar.comI'm going to start using ASP.NET MVC2 for my web application - jqueryOne instruction to clear PF (parity flag) - get an odd number of bits in the result registry - assemblyWhy doesn't the NSPasteboard -type return a union of the types contained in the NSPasteboardItem? - objective-cXcode or iOS will not use my icon-72.png on iPad - iphoneWeb-based reporting tools (similar to Table) - reporting-servicesAll Articles