If we drop locale support completely, we could just call gtk_disable_setlocale (), but since the x11 version was explicitly setting the locale to the user's locale, I thought it was not the solution we should choose. Also i'm confused as to what function should be called, xlib's setlocale or libc setlocale. GTK2 used to have gtk_set_locale as well, but that's deprecated in gtk3.. Xlib's values for constants LC_NUMERIC seem more portable than glibc's and are already defined in x11/xlib.factor Jon
On Mon, May 21, 2012 at 6:31 PM, John Benediktsson <mrj...@gmail.com> wrote: > Good points. Btw, your patch is linux specific for those constants, on OS > X, locale.h has this: > > #define LC_ALL 0 > #define LC_COLLATE 1 > #define LC_CTYPE 2 > #define LC_MONETARY 3 > #define LC_NUMERIC 4 > #define LC_TIME 5 > #define LC_MESSAGES 6 > #define _LC_LAST 7 /* marks end */ > > > On Mon, May 21, 2012 at 9:13 AM, Jon Harper <jon.harpe...@gmail.com> wrote: >> >> Only allowing "." seems a lot simpler. >> If we use the locale dependant decimal point when we print numbers, >> what should we do when parsing numbers ? >> If the parser also uses the locale decimal point, then source code >> compiles differently depending on the locale. >> If the parser doesn't use the locale decimal point, then number>string >> string>number isnt identity anymore. >> >> The solution would be to have 2 different words to parse number in >> "canonical source code form" and numbers in "locale dependant form". >> >> Also, the parser currently hardcodes "," as thousands separtor, but >> it's also locale dependant... >> Jon >> >> >> On Mon, May 21, 2012 at 5:31 PM, John Benediktsson <mrj...@gmail.com> >> wrote: >> > Perhaps another approach would be to add a check in fix-float for a "," >> > similar to the current "." check? >> > >> > On Sun, May 20, 2012 at 8:24 AM, Jon Harper <jon.harpe...@gmail.com> >> > wrote: >> >> >> >> Hi list, >> >> using a french locale (fr_FR.UTF-8) breaks printing of floats: >> >> IN: scratchpad 3.5 . >> >> 3,5.0 >> >> >> >> This is because the decimal point in french is ",", so the output of >> >> (format-float) is "3,5" and fix-float explicitly checks for "." >> >> The locale is forced by gtk to the environnement variables. However, >> >> the old X11 backend also forced the locale (in basis/x11/x11.factor) >> >> so this is should not be new with the gtk backend.. >> >> >> >> So I guess the best solution is to force LC_NUMERIC to a locale that >> >> has a "." as the numeric separator right after gtk_init (for example >> >> set_locale LC_NUMERIC "C"). >> >> Here's a patch that does that: >> >> http://paste.factorcode.org/paste?id=2595 >> >> >> >> Please feel free to modify/improve the patch... >> >> Jon >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Live Security Virtual Conference >> >> Exclusive live event will cover all the ways today's security and >> >> threat landscape has changed and how IT managers can respond. >> >> Discussions >> >> will include endpoint security, mobile security and the latest in >> >> malware >> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> >> _______________________________________________ >> >> Factor-talk mailing list >> >> Factor-talk@lists.sourceforge.net >> >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> > >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Live Security Virtual Conference >> > Exclusive live event will cover all the ways today's security and >> > threat landscape has changed and how IT managers can respond. >> > Discussions >> > will include endpoint security, mobile security and the latest in >> > malware >> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> > _______________________________________________ >> > Factor-talk mailing list >> > Factor-talk@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/factor-talk >> > >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk