Help with some pieces of code
Posted: Sat Aug 06, 2011 6:10 am
Hello.
Well, I already know how to use gettext and how to include files which are not in the same folder. But I need more help.
Look at these pictures:
- https://lh4.googleusercontent.com/-Iudp ... 440/18.png
- https://lh6.googleusercontent.com/-N8iP ... 440/19.png
I haven't to explain the problem, you'll see it perfectly. The index.php file (Welcome to ...) is adapted to gettext and it works. The login.php file is adapted to gettext, but it doesn't work, and I don't know why.
Here are the code of the files involved:
- /local.php:
- /es/login.php
The text (comments, echos, prints...) is not important, the important thing is to know why the login window doesn't show the translation.
Thanks for your help.
Well, I already know how to use gettext and how to include files which are not in the same folder. But I need more help.
Look at these pictures:
- https://lh4.googleusercontent.com/-Iudp ... 440/18.png
- https://lh6.googleusercontent.com/-N8iP ... 440/19.png
I haven't to explain the problem, you'll see it perfectly. The index.php file (Welcome to ...) is adapted to gettext and it works. The login.php file is adapted to gettext, but it doesn't work, and I don't know why.
Here are the code of the files involved:
- /local.php:
Code: Select all
<?php
$locale = "es_ES.utf8";
$I= $_SESSION["IDIOMA"];
if($I=="eo"){ $locale="eo.utf8"; }
if($I=="es"){ $locale="es_ES.utf8"; }
if($I=="en"){ $locale="en_GB.utf8"; }
if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", __DIR__."/locale");
textdomain("messages");
?>Code: Select all
<? require_once(__DIR__."/../local.php"); ?>
<?
if($_GET["idiom"]=="es"){include("ES_es.php");}
if($_GET["idiom"]=="eo"){include("EO_eo.php");}
if($_GET["idiom"]=="vl"){include("ES_vl.php");}
if($_GET["idiom"]=="ek"){include("EU_ba.php");}
if(isset($SESSION)){
//header("location:user.php?mod=inicio"); /* Si ha iniciado la sesion, vamos a user.php */
//echo '<script>top.location.href="user.php?mod=inicio"</script>';
} else {
/* Cerramos la parte de codigo PHP porque vamos a escribir bastante HTML y nos será mas cómodo así que metiendo echo's */
include("function_botones.php");
?>
<title><? print _("Identificación"); ?> </title>
<h1><? print _("Inicio de sesión"); ?> </h1>
<h2><? print _("Identificación"); ?> <?=$_GET["idiom"]?></h2>
<form action="comprueba.php" method="POST" class="miform" name="miform">
<? print _("Nombre:"); ?>
<input type="text" name="login"><br>
<? print _("Contraseña:"); ?> <input type="password" name="pass"><br>
<input type="hidden" name="IDIOMA" value="<?=$_GET["idiom"]?>"/>
<br>
<!--<input type="submit" value="Entrar" class="boton">-->
<table width="100">
<tr>
<td><?=Boton(_("Entrar"),"azul","#","miform",false)?></td>
</tr>
</table>
</form>
<?
} /* Y cerramos el else */
?>Thanks for your help.