TurnKey Linux Virtual Appliance Library

Cannot set LC_MESSAGES to default locale

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?

Jeremy's picture

Appears to be a locale issue

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

Very well could be

'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?


Cannot set LC_MESSAGES to default locale

hi,

I was having the same problem on my debian Squeeze,

 

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_ALL to default locale: No such file or directory

I resolved it like:

apt-get install locales-all

Thanks,
Anish Asokan

Jeremy's picture

Thanks for posting Anish

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 :)

apt-get install

apt-get install locales-all
!!!THANK YOU!!!

THANKS

Thank you, that helped alot.

Thanks you apt-get install

Thanks you

apt-get install locales-all

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)