"WARNING:translate:Unable to set locale" error on Ubuntu 9.10/CentOS 5.4 x64
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo GTK Client (MOVED TO GITHUB) |
Invalid
|
Undecided
|
Unassigned | ||
OpenERP Dutch Lokalisatie Project - Nederland |
Fix Committed
|
Medium
|
The Loeki |
Bug Description
On both Ubuntu 9.10 and CentOS 5.4 x64 the OpenERP client will incorrectly load the locale (in this case, nl_NL.UTF-8) upon login into a database with the error
WARNING:
In translate.py the following line causes this:
locale.
removing the try block reveals the following stack trace:
Traceback (most recent call last):
File "./openerp-
win.sig_login()
File "/usr/local/
log_response = rpc.session.
File "/usr/local/
self.
File "/usr/local/
translate.
File "/usr/local/
locale.
File "/usr/lib/
locale = normalize(
File "/usr/lib/
language, encoding = localetuple
ValueError: too many values to unpack
Upon further analysis, it turns out that 'type(lang)' is not <str>, but <unicode>. Converting lang to str with str(lang) works around the problem, but I'm guessing it really shouldn't be a unicode:
---
if lang:
if type(lang) is not type(''):
lang = str(lang)
---
Changed in openerp-dutch-lok: | |
status: | New → Fix Committed |
importance: | Undecided → Low |
importance: | Low → Medium |
assignee: | nobody → The Loeki (the-loeki) |
Changed in openobject-client: | |
status: | New → Confirmed |
importance: | Undecided → Low |
assignee: | nobody → OpenERP sa GTK client R&D (openerp-dev-gtk) |
status: | Confirmed → New |
Changed in openobject-client: | |
status: | New → Confirmed |
Changed in openobject-client: | |
milestone: | none → 6.0-rc2 |
Hello Loeki,
If you try to set locally the other locale the the default one you will have this exception setlocale( locale. LC_ALL, 'nl_NL' ) python2. 6/locale. py", line 513, in setlocale category, locale)
When you execute the following command to set locale on your python prompt you will get the original Exception . i.e
locale.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
return _setlocale(
locale.Error: unsupported locale setting
So,
sudo locale-gen 'nl_NL.UTF-8'
/var/lib/ locales/ supported. d/local and make the entry of the locale you need.
The gtk tries to set your default locale to nl_NL by locale.setlocale() but your machine does not have the entry in its locale file. ie you need to explicitly make an entry of the locale needed by following ways:
1: using the command:
2: manually edit the file
Then when you restart the gtk . It will easily set the locale.
Thanks,