Opened 17 years ago

Closed 17 years ago

Last modified 12 years ago

#492 closed defect (fixed)

Error: unsupported locale setting — at Version 20

Reported by: jouvin@… Owned by: Emmanuel Blot
Priority: normal Component: TracFrenchTranslation
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description (last modified by Ryan J Ollos)

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

Change History (20)

comment:1 Changed 17 years ago by Emmanuel Blot

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.

comment:2 Changed 17 years ago by jouvin@…

Resolution: fixed
Status: newclosed

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

comment:3 Changed 17 years ago by Emmanuel Blot

Resolution: fixed
Status: closedreopened

comment:4 Changed 17 years ago by Emmanuel Blot

Resolution: worksforme
Status: reopenedclosed

(fixing ticket resolution)

comment:5 Changed 17 years ago by jouvin@…

Resolution: worksforme
Status: closedreopened

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

comment:6 Changed 17 years ago by jouvin@…

Resolution: worksforme
Status: reopenedclosed

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

comment:7 Changed 17 years ago by jouvin@…

Resolution: worksforme
Status: closedreopened

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 ?

comment:8 Changed 17 years ago by Emmanuel Blot

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.

comment:9 Changed 17 years ago 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...

comment:10 Changed 17 years ago by Emmanuel Blot

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

comment:11 Changed 17 years ago by jouvin@…

Work fine. Thanks

comment:12 Changed 17 years ago by anonymous

Resolution: fixed
Status: reopenedclosed

comment:13 Changed 17 years ago 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...

comment:14 Changed 17 years ago by jouvin@…

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

comment:15 in reply to:  14 ; Changed 17 years ago by nicolas.ternisien@…

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.

comment:16 in reply to:  15 Changed 16 years ago 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.

comment:17 Changed 12 years ago by anonymous

on FreeBSD 8.2 rel p3 and cgi : trac 0.13.dev

os.environtrac.locale? = 'fr_FR.UTF-8'

comment:18 Changed 12 years ago by anonymous

should be

os.environ['trac.locale'] =

comment:19 in reply to:  18 Changed 12 years ago by Emmanuel Blot

Replying to anonymous:

should be

os.environ['trac.locale'] =
  1. Locale string depends on the platform; you need to check the locale string format and adapt the setting accordingly;
  2. This plugin is useless since Trac supports localization (several years ago)

comment:20 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)
Note: See TracTickets for help on using tickets.