LC_NUMERIC WIN32

Asked by Sylvain Calador on 2010-02-17

Hi,

I try to change the decimal point character from "float" fields from "," (comma in the french locale default) to "." (point in "C" locale)
I have made the change below, and tested on linux successfully, but on MS Windows (Win32) it doesn't work.
I want to know if it is possible on MS Windows.

Any hint appreciated.

Thanks

Sylvain CALADOR
Logical Soft

=== modified file 'bin/translate.py'
--- bin/translate.py 2009-01-06 21:56:18 +0000
+++ bin/translate.py 2010-02-17 17:45:18 +0000
@@ -179,6 +179,7 @@
         lang_enc = lang2 + '.' + encoding
         try:
             locale.setlocale(locale.LC_ALL, lang_enc)
+ locale.setlocale(locale.LC_NUMERIC, 'C')
         except:
             logging.getLogger('translate').warning(
                     _('Unable to set locale %s') % lang_enc)

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo GTK Client (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Sylvain Calador
Solved:
Last query:
Last reply:
Revision history for this message
Sylvain Calador (sylvain-calador) said :
#1

I found another "dirty" solution, which should works on all OS,
and allow to enter dot or comma as decimal separator.

=== modified file 'bin/widget/view/form_gtk/spinbutton.py'
--- bin/widget/view/form_gtk/spinbutton.py 2009-01-04 22:13:17 +0000
+++ bin/widget/view/form_gtk/spinbutton.py 2010-03-04 08:38:14 +0000
@@ -31,7 +31,7 @@

         adj = gtk.Adjustment(0.0, -sys.maxint, sys.maxint, 1.0, 5.0)
         self.widget = gtk.SpinButton(adj, 1.0, digits=int( attrs.get('digits',(14,2))[1] ) )
- self.widget.set_numeric(True)
+ self.widget.set_numeric(False)
         self.widget.set_activates_default(True)
         self.widget.connect('button_press_event', self._menu_open)
         if self.attrs['readonly']:

Thanks