I've shared hosting by asphostportal. Can anyone tell me how to get PHP gettext working on shared hosting? This is code I tried:
Code:
function namesti_jezik($jezik='rs')
{
// Set language to German
putenv('LC_ALL='.$jezik);
setlocale(LC_ALL, $jezik);
// Specify location of translation tables
bindtextdomain($this->CI->config->item('aplikacija_domen'), "./lokal");
// Choose domain
textdomain($this->CI->config->item('aplikacija_domen'));
$param=array(
'jezik'=>$jezik
);
$this->CI->session->set_userdata($param);
// Translation is looking for in ./locale/de_DE/LC_MESSAGES/myPHPApp.mo now
}
and
Code:
function namesti_jezik($jezik='rs')
{
putenv("LANG=".$jezik); //not needed for my tests, but people say it's useful for windows
setlocale( LC_MESSAGES, $jezik);
bindtextdomain($this->CI->config->item('aplikacija_domen'), dirname(BASEPATH).'/lokal');
textdomain($this->CI->config->item('aplikacija_domen'));
$param=array(
'jezik'=>$jezik
);
$this->CI->session->set_userdata($param);
}
The first one works on development machine. Both of these don't work on shared hosting and I have locales I need enabled. Any help is appreciated. Thanks.
Bookmarks