Ticket #492 (closed defect: fixed)

Opened 2 years ago

Last modified 9 months ago

Error: unsupported locale setting

Reported by: jouvin@lal.in2p3.fr Assigned to: eblot
Priority: normal Component: TracFrenchTranslation
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Hi,

I am trying to install TracFrenchTranslation. I created a separate area for french Trac projects (I have only one standard Trac instance running with a lot of projects). When I start the french Trac, I get the following Python error :

Error: unsupported locale setting

The traceback is :

/www/Web/servers/trac/0.10-french-1005/lib/python2.4/site-packages/trac/web/main.py in dispatch_request(environ={'DOCUMENT_ROOT': '/htdocs/tracfr', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': 'image/gif, image/x-xbitmap, image/jpeg, image/pj...cation/vnd.ms-powerpoint, application/msword, */*', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'fr', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_HOST': 'tracfr', 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)', 'PATH': '/usr/bin:/usr/sbin:/sbin', ...}, start_response=<function start_response>)

258 else:

259 if os.name == 'posix':

260 locale.setlocale(locale.LC_ALL, 'fr_FR')

261 elif os.name == 'nt':

262 locale.setlocale(locale.LC_ALL, 'French_France')

global locale = <module 'locale' from '/usr/local/Python/2.4.1/lib/python2.4/locale.pyc'>, locale.setlocale = <function setlocale>, locale.LC_ALL = 65535

/usr/local/Python/2.4.1/lib/python2.4/locale.py in setlocale(category=65535, locale='fr_FR')

377 # convert to string

378 locale = normalize(_build_localename(locale))

379 return _setlocale(category, locale)

380

381 def resetlocale(category=LC_ALL):

global _setlocale = <built-in function setlocale>, category = 65535, locale = 'fr_FR'

Error: unsupported locale setting

args = ('unsupported locale setting',)

I am pretty sure I made something wrong but I cannot figure out why...

Any help appreciated.

Michel

Attachments

Change History

07/06/06 12:19:37 changed by eblot

Did you build the locale for fr_FR ?

Try to set your locale to the same value: export LC_ALL="fr_FR"

and use a localized command, for example 'man ls'
If you get an error, this means that you forgot to build your locale files for the french language.

ps: for the sake of readibility, please use the {{{ }}} syntax to paste your python traceback when reporting an issue.

07/07/06 10:24:54 changed by jouvin@lal.in2p3.fr

  • status changed from new to closed.
  • resolution set to fixed.

Sorry for forgetting {{{ }}}...

Thanks for your help, I was guessing it was related to missing parts in NLS configuration. I am trying to solve it (this is not on Linux... Tru64).

Michel

07/07/06 11:12:46 changed by eblot

  • status changed from closed to reopened.
  • resolution deleted.

07/07/06 11:13:10 changed by eblot

  • status changed from reopened to closed.
  • resolution set to worksforme.

(fixing ticket resolution)

07/10/06 08:55:34 changed by jouvin@lal.in2p3.fr

  • status changed from closed to reopened.
  • resolution deleted.

I fixed the language installation problem on my system, Tru64. Unfortunatly, the locale is called fr_FR.ISO8859-1 instead of fr_FR. Is there any possibility to define this externally (e.g. trac.ini, defining LC_ALL env var when launching trac.fcgi doesn't seem to work).

07/11/06 03:47:35 changed by jouvin@lal.in2p3.fr

  • status changed from reopened to closed.
  • resolution set to worksforme.

It is pretty simple : just define LC_ALL with -initial-env when launching the FCGI. And don't forget to stop/start Apache (graceful restart is not enough as this setting is processed by Apache master).

07/11/06 04:03:48 changed by jouvin@lal.in2p3.fr

  • status changed from closed to reopened.
  • resolution deleted.

I reopen this ticket again. I made a mistake testing the previous solution and it doesn't work : locale definition is done unconditionally, whenever the LC_ALL is set or not. There is a test for 'trac.locale' being defined but how to define it ?

07/11/06 18:27:50 changed by eblot

With mod_python, you probably need to add the following rule:

PythonOption TracLocale "fr_FR.ISO8859-1"

to your Apache config file.

TracFrenchTranslation falls back to "fr_FR" if no custom locale is defined.

07/12/06 03:49:28 changed by anonymous

Thanks for the info. I am using FastCGI, thus I tried to define env variable TRAC_LOCALE. But it doesn't (seem) to work. May be there is something to add in fcgi.py to retrieve the env variable ? I'll try to have a look if I find 5 minutes...

07/12/06 04:00:39 changed by eblot

Actually, it was not supported, as there was no handler for this case. Can you give a try with [1015] and "TRAC_LOCALE"?

07/12/06 05:01:53 changed by jouvin@lal.in2p3.fr

Work fine. Thanks

07/12/06 05:02:01 changed by anonymous

  • status changed from reopened to closed.
  • resolution set to fixed.

09/07/06 14:28:31 changed by Mudounet

For my system (Ubuntu) I used

dpkg-reconfigure locales

With this, I learned that my locale was fr_FR.UTF-8

I just had to add this line in Apache:

PythonOption TracLocale "fr_FR.UTF-8"

And it worked...

(follow-up: ↓ 15 ) 09/07/06 15:52:20 changed by jouvin@lal.in2p3.fr

But I am running Fastcgi... that was the problem !

(in reply to: ↑ 14 ; follow-up: ↓ 16 ) 09/16/06 02:58:22 changed by nicolas.ternisien@gmail.com

Replying to jouvin@lal.in2p3.fr:

But I am running Fastcgi... that was the problem !

On Ubuntu, you need to set the option like this :

PythonOption? TracLocale? "fr_FR.utf-8"

else, it will not work.

(in reply to: ↑ 15 ) 03/18/08 03:21:27 changed by anonymous

I am running FreeBSD 6.2-STABLE. I have no idea if it has something to te subject, but setting Python option didn't help me. I had to add: SetEnv LC_ALL pl_PL.ISO8859-2 next to the TracLocale?.


Add/Change #492 (Error: unsupported locale setting)




Change Properties
Action