Skip to content

Instantly share code, notes, and snippets.

@evilnapsis
Last active November 29, 2017 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilnapsis/94b9ad89bb50b9f77045f96dd11c29ce to your computer and use it in GitHub Desktop.
Save evilnapsis/94b9ad89bb50b9f77045f96dd11c29ce to your computer and use it in GitHub Desktop.
Ejemplo de pagina multi-idioma facil con php
<!-- Powered by http://evilnapsis.com/ -->
<?php
$lang = "es";
if(isset($_GET["lang"]) && $_GET["lang"]!=""){
if($_GET["lang"]=="en" || $_GET["lang"]=="es"){
$lang = $_GET["lang"];
}
}
$frases = array(
"es"=>array(
"frase1"=>"Bienvenido!",
"frase2"=>"Este micro sitio web es multi-idioma",
"frase3"=>"Servicios",
"frase4"=>"Los mejores servicios para ti"
),
"en"=>array(
"frase1"=>"Welcome!",
"frase2"=>"This micro website is multi-language",
"frase3"=>"Services",
"frase4"=>"The best services for you"
)
);
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p><a href="paginax.php?lang=es">Espa~ol</a> <a href="paginax.php?lang=en">Ingles</a></p>
<h1><?php echo $frases[$lang]["frase1"]; ?></h1>
<p class="lead"><?php echo $frases[$lang]["frase2"]; ?></p>
<h2><?php echo $frases[$lang]["frase3"]; ?></h2>
<p ><?php echo $frases[$lang]["frase4"]; ?></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment