Page MenuHomePhabricator

locale.setlocale(locale.LC_ALL, "ca_AD") doesn't work
Closed, ResolvedPublic


Author: coet.cawiki

Can some one install locale for Python?

I can run the because locale.setlocale() doesn't support changes.

I'm interested to implement the char set for Catalan, but I've seen that doesn't work for many other language sets. I tried with:

  • locale.setlocale(locale.LC_ALL, "ca_AD")
  • locale.setlocale(locale.LC_ALL, "ca_ES")
  • locale.setlocale(locale.LC_ALL, "es_ES")

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:01 AM
bzimport added a project: Toolforge.
bzimport set Reference to bz62269.

coet.cawiki wrote:

Sorry, it it possible to get any answer about this topic?

Change 140239 had a related patch set uploaded by Tim Landscheidt:
Tools: Install Catalan locale

NB: On Ubuntu, the locales are named "ca_AD.UTF8" & Co.:

scfc@tools-dev:~$ LANG=ca_AD date
Tue Jun 17 22:20:21 UTC 2014
scfc@tools-dev:~$ LANG=ca_AD.UTF8 date
dt jun 17 22:20:26 UTC 2014

I don't know if Python adds ".UTF8" automatically, so, if it does not you'll need to change the names (after the referenced patch gets merged).

coet.cawiki wrote:

I have tried "LANG=ca_AD date" and it works fine. But when I type "locale -a", ca_AD and other stuffs don't appear. Then in python console when I type "import locale;locale.setlocale(locale.LC_ALL, "ca_AD"), it returns:

Traceback (most recent call last):

File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/", line 539, in setlocale
  return _setlocale(category, locale)

locale.Error: unsupported locale setting

As far away as I know this behavior requires to add the ca_AD locale. As it is said on it can be fix with the command "locale-gen ca_AD"

Change 140239 merged by Alexandros Kosiaris:
Tools: Install Catalan locale

Has been merged, should be present in the nodes in about 30minutes. Can you test and verify after that? Thanks!