With the new update of PHP coming out it seems they have removed LC_MESSAGES
and either LC_ALL
, LC_COLLATE
, LC_CTYPE
, LC_MONETARY
, LC_NUMERIC
, or LC_TIME
must be used instead, I have changed my LC_MESSAGES
to LC_ALL
but am receiving this error:
Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead
Here is my code for reference:
public static function gettext()
{
//include the libs
include(Config::get('PATH_LIBS')."streams.php");
include(Config::get('PATH_LIBS')."gettext.php");
//define all the language settings
define('LOCALE', 'en_GB');
define('SESSION_LOCALE_KEY', 'locale');
define('DEFAULT_LOCALE', 'en_GB');
define('LOCALE_REQUEST_PARAM', 'lang');
define('WEBSITE_DOMAIN', 'messages');
//check if the language exists
if(array_key_exists(LOCALE_REQUEST_PARAM, $_REQUEST)):
$current_locale = $_REQUEST[LOCALE_REQUEST_PARAM];
$_COOKIE[SESSION_LOCALE_KEY] = $current_locale;
elseif(array_key_exists(SESSION_LOCALE_KEY, $_COOKIE)):
$current_locale = $_COOKIE[SESSION_LOCALE_KEY];
else:
$current_locale = DEFAULT_LOCALE;
endif;
//will eventually stick this all in the model file
putenv("LC_TIM=en_GB");
putenv("LC_MESSAGES=$current_locale");
setlocale('LC_ALL', $current_locale);
//bind it all
bindtextdomain(WEBSITE_DOMAIN, Config::get('PATH_MAIN').'lang/');
bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8');
textdomain(WEBSITE_DOMAIN);
}