- ids = lang_obj.search(cr, uid, [('code','=',lang)])
- lc, encoding = locale.getdefaultlocale()
- if not encoding:
- encoding = 'UTF-8'
- if encoding == 'utf' or encoding == 'UTF8':
- encoding = 'UTF-8'
- if encoding == 'cp1252':
- encoding= '1252'
- if encoding == 'iso-8859-1':
- encoding= 'iso-8859-15'
- if encoding == 'latin1':
- encoding= 'latin9'
-
- # this block temporarily sets the locale to the requested lang, so that
- # some defaults are read from it.
- try:
- if os.name == 'nt':
- locale.setlocale(locale.LC_ALL, str(_LOCALE2WIN32.get(lang, lang) + '.' + encoding))
- else:
- locale.setlocale(locale.LC_ALL, str(lang + '.' + encoding))
- except Exception:
- netsvc.Logger().notifyChannel(' ', netsvc.LOG_WARNING,
- 'unable to set locale "%s"' % (str(lang + '.' + encoding)))
- # Now, the default locale is still active, so the values can be
- # read from that.
- try:
- locale.setlocale(locale.LC_ALL, str(lc + '.' + encoding))
- except:
- pass
-
+ ids = lang_obj.search(cr, uid, [('code','=', lang)])
+