He leido alrrededor de 5 mensajes en este foro que hablan sobre mi tema, tambien 3 faqs y mucha informacion de internet, pero no he conceguido una el multilenguaje compatible con la estructura de mi sitio web
Recientemente fabrique un pequeño sistema en PHP sin usar bases de datos, ahora deseo incorporar multilenguaje a mi sitio pero no puedo hacerlo de la manera que yo planeaba.
Explico, mi sitio web actualmente tiene esta sintaxis
Misitio
Código HTML:
/includes/ /config.php /language/spanish.php /language/english.php index.php contact-us.php
mis archivos estan mas o menos asi:
includes/config.php
Código PHP:
<?php
$style = "themes/default/style.css";
$lang = "spanish";
?>
[PHP]
<?php
$lang['title'] = 'Mi titulo';
$lang['text1'] = 'Cualquier texto en español';
$lang['text2'] = 'Cualquier otro texto en español';
$lang['name'] = 'Introdusca su nombre:';
$lang['lastname'] = 'Introdusca su apellido:';
$lang['email'] = 'Introdusca su email:';
?>
[/PHP
includes/language/english.php
Código PHP:
<?php
$lang['title'] = 'My title';
$lang['text1'] = 'Any text in English';
$lang['text2'] = 'Any other text in English';
$lang['name'] = 'Enter your name:';
$lang['lastname'] = 'Enter your lastname:';
$lang['email'] = 'Enter your email:';
?>
index.php
Código PHP:
<?php include('includes/config.php');?>
<?php include('includes/language/'.$lang.'.php');?>
<html>
<head>
<title> <?php echo $lang['title'];?> </title>
<style link="rel" type="text/css" href='<?php echo "$style";?>'>
</head>
<body>
<?php echo $lang['text1'];?>
</body>
</html>
Código PHP:
<?php include('includes/config.php');?>
<?php include('includes/language/'.$lang.'.php');?>
<html>
<head>
<title> <?php echo $lang['title'];?> </title>
<style link="rel" type="text/css" href='<?php echo "$style";?>'>
</head>
<body>
<?php echo $lang['text2'];?>
<form>
<?php echo $lang['name'];?><input type="text">
<?php echo $lang['lastname'];?><input type="text">
<?php echo $lang['email'];?><input type="text">
</form>
</body>
</html>
Pero lo que necesito es:
*Cambiar el idioma de la página al dar click en por ejemplo:
view in english | ver en español
*Conservar el idioma seleccionado al navegar entre links.
He visto que las paginas utilizan por ejemplo:
index.php?lang=en
contact-us.php?lang=en
*Establecer un idioma por defecto si el usuario no selecciona ninguno.
Muchas gracias por la ayuda.
Saludos!