Se puede hacer guardando los idiomas en la base de datos y generando las funciones con un eval dependiendo del registro que tenga en la base de datos pero te muestro como se hace con archivos mira el siguiente codigo:
Código PHP:
Ver original<?php
function getIdioma(){
$leng = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$leng = $exp[0];
switch($leng){
$leng = "es";
break;
$leng = "en";
break;
$leng = "fr";
break;
default: //Si no es ninguno de los anterior el idioma por defecto es ingles
$leng = "en";
}
return $leng;
}
function encabezado(){
$texto_es = "Encabezado en español";
$texto_en = "Header English";
$texto_fr = "Français-tête";
return ${'texto_'.getIdioma()};
}
function cuerpo(){
$texto_es = "Texto del documento todo en español, aquí todo la información";
$texto_en = "Text of the document all in English, here all the information";
$texto_fr = "Le texte du document tout en français, ici toutes les informations";
return ${'texto_'.getIdioma()};
}
?>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title></title>
</head>
<body>
<h1><? echo encabezado(); ?></h1>
<? echo cuerpo();?>
</body>
</html>
Espero que te sirva