Modify

Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#492 closed defect (fixed)

Error: unsupported locale setting

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

Description (last modified by rjollos)

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 (0)

Change History (22)

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

comment:2 Changed 9 years ago by jouvin@…

  • Resolution set to fixed
  • Status changed from new to closed

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 9 years ago by eblot

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 Changed 9 years ago by eblot

  • Resolution set to worksforme
  • Status changed from reopened to closed

(fixing ticket resolution)

comment:5 Changed 9 years ago by jouvin@…

  • Resolution worksforme deleted
  • Status changed from closed to reopened

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 9 years ago by jouvin@…

  • Resolution set to worksforme
  • Status changed from reopened to closed

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 9 years ago by jouvin@…

  • Resolution worksforme deleted
  • Status changed from closed to reopened

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 9 years ago 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.

comment:9 Changed 9 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 9 years ago 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"?

comment:11 Changed 9 years ago by jouvin@…

Work fine. Thanks

comment:12 Changed 9 years ago by anonymous

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:13 Changed 8 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 follow-up: Changed 8 years ago by jouvin@…

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

comment:15 in reply to: ↑ 14 ; follow-up: Changed 8 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 7 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 3 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 follow-up: Changed 3 years ago by anonymous

should be

os.environ['trac.locale'] =

comment:19 in reply to: ↑ 18 ; follow-up: Changed 3 years ago by eblot

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 3 years ago by rjollos

  • Description modified (diff)

comment:21 in reply to: ↑ 19 ; follow-up: Changed 3 years ago by rjollos

Replying to eblot:

  1. This plugin is useless since Trac supports localization (several years ago)

I added the deprecated tag to the wiki page. There are 7 open tickets for this plugin. Should they be closed as wontfix since it sounds like you don't plan to support it any longer given the Trac 0.12 support?

comment:22 in reply to: ↑ 21 Changed 3 years ago by eblot

Replying to rjollos:

Should they be closed as wontfix since it sounds like you don't plan to support it any longer given the Trac 0.12 support?

You're right. Done.

Add Comment

Modify Ticket

Action
as closed The owner will remain eblot.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.