Problem with php coding...
Posted: Mon Apr 18, 2011 8:26 pm
I've the following code, there is an error but I can't quite figure it out. If someone see something wrong with the code, please shed some light. Thanks...
Fatal error: Call to undefined function bind_textdomain_codeset() in /Users/Jesper/Documents/workspace/neptunediving.com/inc/config.php on line 47
Fatal error: Call to undefined function bind_textdomain_codeset() in /Users/Jesper/Documents/workspace/neptunediving.com/inc/config.php on line 47
Code: Select all
<?php
session_start();
// Error config
ini_set('display_errors',1);
error_reporting(E_ALL);
// DB config
$dbhost = 'localhost';
$dbuser = 'neptune';
$dbpass = 'neptunediving';
$dbname = 'neptune';
include $ROOT . '/inc/functions.php';
// Define available and default locales
$available_locales = array('en_GB', 'ru_RU', 'sv_SE');
$default_locale = 'en_GB';
// Check if locale is set in session
if (! isset($_SESSION['locale'])){
// Check users locale
$user_locale = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
//Check if users locale is available
if (in_array($user_locale, $available_locales)){
$_SESSION['locale'] = $user_locale;
} else {
$_SESSION['locale'] = $default_locale;
}
}
// Check if user want to change the locale
if (isset($_GET['locale']) && $_GET['locale'] != 'null'){
$requested_locale = $_GET['locale'];
// Check if users choice is available
if (in_array($requested_locale, $available_locales)){
$_SESSION['locale'] = $requested_locale;
}
}
// Set chosen locale for whole site
putenv("LANGUAGE=" . $_SESSION['locale']);
putenv("LANG=" . $_SESSION['locale']);
setlocale(LC_ALL, $_SESSION['locale']);
bind_textdomain_codeset("messages", 'utf8');
bindtextdomain('messages', $ROOT . '/locale');
textdomain('messages');
date_default_timezone_set('Asia/Manila');
?>