Page MenuHomePhabricator

Locale on Kubernetes
Closed, ResolvedPublic

Description

In PHP,

setlocale ( LC_COLLATE , 'en_US.UTF-8' ) ;

works in the shell but not on Kubernetes. Please add this locale, or tell me which locale to use instead. The default ("C") doesn't really cut it.

Event Timeline

Change 308692 had a related patch set uploaded (by Yuvipanda):
base: Set default locale to be nicer than C

https://gerrit.wikimedia.org/r/308692

I've rebuilt the containers, will push them tomorrow to have better locale support!

Change 308692 merged by jenkins-bot:
base: Set default locale to be nicer than C

https://gerrit.wikimedia.org/r/308692

I've pushed it now. The default LOALE should be set to C.UTF-8 i think. See
if the default works ok for you now?

Ah, as I already said in the patch review comment, C.UTF-8 doesn't work for me. It should sort É after E, but it gets sorted after Z. It works fine with en_US.UTF-8, so unless there is another way to get that in PHP, I would need "en_US.UTF-8".
I fear this might pop up for other languages as well, but I understand that you don't want to flood Kubernetes instances with all possible locales.
An alternative would be for me to spin up a dedicated VM for the tool in question. Any ideas?

Magnus claimed this task.

Fixed it! Apparently, the PHP Collator class (https://secure.php.net/manual/en/class.collator.php ) does not rely on the system locale, so I'm using that. Works in production, all is well.

Thanks! I will also add en_US.UTF-8 to the image. I *might* also have to
add all locales, will see.