You do it by cookie or session (I like cookies better), it will contain a number corresponding to the language ID. You will then have a language array (example in php)
PHP Code:
//this code sets the array
$phrase["Welcome message"]["0"] = "Hello, welcome to the site";
$phrase["Welcome message"]["1"] = "Hola, bienvenido al sitio. ";
$phrase["Welcome message"]["2"] = "Bonjour, accueillir au site. ";
Now in the file
PHP Code:
echo $phrase["$lang_id"]["meaning"];
I would store them in a hard coded array rather then a database, each page should have its own opposed to the entire site storing every pages. Store universal ones in a header file.