PHP Classes

File: examples/php/i18n/i18n.php

Recommend this page to a friend!
  Classes of Joseluis Laso   Tradukoj PHP Po File Generator   examples/php/i18n/i18n.php   Download  
File: examples/php/i18n/i18n.php
Role: Auxiliary script
Content type: text/plain
Description: Example script
Class: Tradukoj PHP Po File Generator
Convert locale CSV file to PO and send to Tradukoj
Author: By
Last change: Update of examples/php/i18n/i18n.php
Date: 5 months ago
Size: 760 bytes
 

Contents

Class file image Download
<?php

$langs
= array (
 
'es' => 'ES',
 
'en' => 'GB',
);

$code = isset($_REQUEST['lang'])?$_REQUEST['lang']:'en';

if (isset(
$langs[$code]))
   
$iso_code = $code.'_'.$langs[$code];
else{
   
$code = "en";
   
$iso_code = 'en_GB';
}

if (isset(
$_SESSION['lang'])) $_SESSION['lang']=$code;

print
"$iso_code\n";

// Set the LANGUAGE environment variable to the desired language
putenv ('LANGUAGE='.$iso_code);
putenv ("LC_ALL=$iso_code");
setlocale(LC_ALL, $iso_code);

// Bind a domain to directory
// Gettext uses domains to know what directories to
// search for translations to messages passed to gettext
bindtextdomain('default', dirname(__FILE__).'/');
//die(dirname(__FILE__));
// Set the current domain that gettext will use
textdomain ('default');