1 Replies - 812 Views - Last Post: 09 January 2009 - 02:54 AM Rate Topic: -----

#1 joy.lasrado  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-January 09

check this code and please for language translator

Posted 09 January 2009 - 02:48 AM

please check this
localization.php
<?php
$locale = false;
//echo $locale;
//exit();
if (isSet($_GET["locale"])){
$locale = $_GET["locale"];
//echo $locale;
//exit;
setcookie("locale", $locale, time()+60*60*24*30, "/");// save a cookie
}
if (!$locale && isSet($_COOKIE["locale"])){
$locale = $_COOKIE["locale"];
}
//echo $locale;
putenv("LC_ALL=$locale");//needed on some systems
putenv("LANGUAGE=$locale");//needed on some systems
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
bind_textdomain_codeset("messages", "UTF-8");
textdomain("messages");
?>

**************************
<?php require_once "localization.php";?>
<html><head></head>
<body>
<a href="?locale=en_US">English</a> |
<a href="?locale=es_ES">Spanish</a> |
<a href="?locale=de_DE">German</a>
<br>
<?php echo _("Hello World!");?><br>
<p><?php echo _("My name is");?> Bob.</p>
</body>
</html>


Is This A Good Question/Topic? 0
  • +

Replies To: check this code and please for language translator

#2 joy.lasrado  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-January 09

Re: check this code and please for language translator

Posted 09 January 2009 - 02:54 AM

what happens here is no language translation takes place so what should i do here
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1