c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #06644
[Bug 510023] Re: "WARNING:translate:Unable to set locale" error on Ubuntu 9.10/CentOS 5.4 x64
Hello Loeki,
If you try to set locally the other locale the the default one you will have this exception
When you execute the following command to set locale on your python prompt you will get the original Exception . i.e
locale.setlocale(locale.LC_ALL,'nl_NL')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/locale.py", line 513, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
So,
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:
sudo locale-gen 'nl_NL.UTF-8'
2: manually edit the file
/var/lib/locales/supported.d/local and make the entry of the locale you need.
Then when you restart the gtk . It will easily set the locale.
Thanks,
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/510023
Title:
"WARNING:translate:Unable to set locale" error on Ubuntu 9.10/CentOS 5.4 x64
Status in OpenERP-Dutch-localisation:
Fix Committed
Status in OpenObject GTK Client:
Confirmed
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:translate:Unable to set locale nl_NL.UTF-8
In translate.py the following line causes this:
locale.setlocale(locale.LC_ALL, lang_enc
removing the try block reveals the following stack trace:
Traceback (most recent call last):
File "./openerp-client.py", line 135, in <module>
win.sig_login()
File "/usr/local/lib/python2.6/dist-packages/openerp-client/modules/gui/main.py", line 1023, in sig_login
log_response = rpc.session.login(*res)
File "/usr/local/lib/python2.6/dist-packages/openerp-client/rpc.py", line 233, in login
self.context_reload()
File "/usr/local/lib/python2.6/dist-packages/openerp-client/rpc.py", line 290, in context_reload
translate.setlang(self.context['lang'])
File "/usr/local/lib/python2.6/dist-packages/openerp-client/translate.py", line 184, in setlang
locale.setlocale(locale.LC_ALL,lang_enc)
File "/usr/lib/python2.6/locale.py", line 514, in setlocale
locale = normalize(_build_localename(locale))
File "/usr/lib/python2.6/locale.py", line 422, in _build_localename
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)
---