detect system language
How can I detect system language in a query?
I have found a site that very well describes how to build a multilingual website. The address is: https://www.apphp.com/tutorials/index.php?page=multilanguage-database-design-in-mysql
I intend to use method 4 for my project.
The article shows examples of what a sql query can look like to retrieve appropriate title according to the chosen language in the system.
I think this seems like a smooth solution. Or do you have any better suggestions?
According to another website, you can "pick" the browser language: https://www.geeksforgeeks.org/how-to-detect-browser-language-in-php/
I call the session "lang". And I want to set this to "substr ($ _ SERVER ['HTTP_ACCEPT_LANGUAGE'], 0, 2);"
I have two questions if I should use the examples from the above mentioned pages.
1. How do I write the same query with the WA MySQLi Recordset?
2. How do I create the session. Is this code correct:
<? Php
@session_start ();
if (! isset ($ _ SESSION ["long"])) {
$ _SESSION ["long"] = "substr ($ _ SERVER ['HTTP_ACCEPT_LANGUAGE'], 0, 2);";
}
?>
Is there any complete guide you offer on how to do this? It should be of great public interest.