Initial commit for radiantprestation project
This commit is contained in:
48
Framework/Localisation.php
Normal file
48
Framework/Localisation.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
define('PROJECT_DIR', realpath('./Gettext/'));
|
||||
define('LOCALE_DIR', PROJECT_DIR .'/locale');
|
||||
define('DEFAULT_LOCALE', 'fr_FR');
|
||||
|
||||
// require_once('./Gettext/gettext.inc');
|
||||
// require_once('/Gettext/gettext.inc');
|
||||
require_once(PROJECT_DIR .'/gettext.inc');
|
||||
|
||||
$supported_locales = array('fr_FR', 'en_US');
|
||||
$encoding = 'UTF-8';
|
||||
|
||||
/*
|
||||
$locale = (isset($_SESSION['p_lang']))? $_SESSION['p_lang'] : DEFAULT_LOCALE;
|
||||
|
||||
$locale = 'en_US';
|
||||
*/
|
||||
|
||||
if (isset($_SESSION['p_lang']))
|
||||
{
|
||||
$locale = $_SESSION['p_lang'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$locale = DEFAULT_LOCALE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// gettext setup
|
||||
T_setlocale(LC_MESSAGES, $locale);
|
||||
|
||||
$domain = 'messages';
|
||||
|
||||
bindtextdomain($domain, LOCALE_DIR);
|
||||
|
||||
// bind_textdomain_codeset is supported only in PHP 4.2.0+
|
||||
if (function_exists('bind_textdomain_codeset'))
|
||||
bind_textdomain_codeset($domain, $encoding);
|
||||
|
||||
textdomain($domain);
|
||||
|
||||
//header("Content-type: text/html; charset=$encoding");
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user