多语言网站:php + mysql + cookies

I have coded a multilingual web with php & mysql. Now I've faced problems (mainly with robots, seo and search engines) because language chooser is based on cookies.

how it works now: user => index.php :

function cookies() {
 if (!isset($_COOKIE["lang"])){
 setcookie('lang','ukr', time()+(60*60*24*31)); 
 header('Location: index.php');  
}};

and outputting chosen language to every place it needed to be with the function:

function catSet($source, $link, $item){
 $item .= '_'. $_COOKIE['lang'];
 global $connection;
 $link = mysqli_real_escape_string($connection, $link);
 $result = mysqli_query($connection, "SELECT * FROM  $source WHERE link_item = '". $link ."'");
if (!$result) { die("DB Query failed: " . mysql_error()); }
while ($row = mysqli_fetch_array ($result)) {
 echo $row[$item]; }}

What I want now is to have $item .= '_'. $_COOKIE['lang']; to be replaced with constant based on a user choice which would be readable by robots and search engines, so it's a must it's not a cookie.

I don't want to use session, because this way user have to re-choose language each time after session expires.

AFAIK there is no way to detect browsers language, to set it as default.

I see a way out to use [GET] variable instead, and pass it each time to other page, but how to store this [GET] data if user come back next time (same problem as with sessions).

I would appreciate any ideas and solutions :)

You can still use cookies to save user decision. When user visit your website without language in url (GET) but got cookie with selected language, redirect him to url with selection.

It'll allow you to use addresses with given language and also will allow user to just copy/past his current URL which will always lead him to his language version.

For localization you can use gettext extension of PHP this uses .po and .mo file format for content translation. This will solve problem of SEO as well. All the contents loaded in memory of server in form of object and seen on browser as per requested language. For more detail read here