flexbean's picture

I'm running the Status.net appliance and I can't seem to figure out why /var/log/apache2/error.log is getting the following added with each page access:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory

Any ideas?

Forum: 
Jeremy Davis's picture

A quick google of "locale: Cannot set LC_CTYPE to default locale: No such file or directory" suggests a few solutions to try. Seems like it can have a number of causes but the most likely I'd guess is that the selected locale is not installed.

flexbean's picture

'locale -a' gives

C
POSIX
en_GB

Which looks consistent with the languages supported in status.net as the /var/www/statusnet/locale directory contains

Makefile af arz br cs de en eo fa fr ga he hu is ja ko ml nl pl pt_BR statusnet.pot te uk zh_CN
README ar bg ca da el en_GB es fi fur gl hsb ia it ka mk nb nn pt ru sv tr vi zh_TW

A hack of /var/www/statusnet/lib/util.php revealed that 'en' and 'en_US' were the languages being attempted (note there is no en_US entry in locale/ per above). The following hack the util.php file corrects the problem

function common_init_locale($language=null)
{
   if(!$language) {
      $language = common_language();
   }
   if ($language=='en_US') { $language='en_GB'; } # replace missing en_US with en_GB
   putenv('LANGUAGE='.$language);
   putenv('LANG='.$language);
   $ok = setlocale(LC_ALL, $language . ".utf8",
      $language . ".UTF8",
      $language . ".utf-8",
      $language . ".UTF-8",
      $language);

   return $ok;
}

'php /var/www/statusnet/scripts/setconfig.php' gaves the site language of 'en' 

config.php containes $config['site']['language']='en';

So these look ok.

I hate to go forward with such a hack it will be nixed when statusnet is updated. Any ideas?


Jeremy Davis's picture

But unfortunately I don't think that will work in Ubuntu. Apparently locale config works a little differently in Ubuntu (10.04 - the basis of TKL) than it does in Debian. I've just had a quick google and it seems that there are a number of different ways to attack this issue and I guess it depends on why it's not working as to which fix will work.

@Flexbean, it looks like you'll need to do a little googling and do a bit of trial and error. I just searched "install locale ubuntu 10.04 server" and it turned up lots of results that seemed relevant, although the term 'configure' may also be useful instead of 'install'. Be excellent if you could post back what ends up working for you. I'm sure others would find it useful and perhaps we could make it a wiki entry.

Thanks again :)

Add new comment