[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: PCB Gtk port



Hi,

    Is it possible to obtain the current locale, save it, then change to the output locale, save the file, then restore the original locale?

Mike

Bill Wilson wrote:
On Tue, 08 Mar 2005 12:14:36 +0100 (CET)
Magnus Danielson <cfmd@xxxxxxxxxxxx> wrote:

  
I'd prefer to have a file format which doesn't change based on locale.  
We should also check that, for example, the x-y (centroid) output file
is not corrupted since it uses a "," to seperate fields.
      
Locales should control the presentation and acceptance format of values, not
the file formats. That should match both needs.
    

I've now made it:

#if defined (ENABLE_NLS)
    /* Do our own setlocale() stufff since we want to override LC_NUMERIC
    */
    gtk_set_locale();
    setlocale(LC_NUMERIC, "POSIX");  /* use decimal point instead of comma */
#endif

    /* Prevent gtk_init() and gtk_init_check() from automatically
    | calling setlocale (LC_ALL, "") which would undo LC_NUMERIC if ENABLE_NLS
    | We also don't want locale set if no ENABLE_NLS to keep POSIX LC_NUMERIC.
    */
    gtk_disable_setlocale();
    gtk_init(argc, argv);


So if there's no ENABLE_NLS, gtk is stopped from setting the locale; and data
formats and gui presentation is in decimal point "C" locale as was with the
Xt PCB.   And when the configure script is set up to ENABLE_NLS for translations,
this will override to keep LC_NUMERIC as before.  I don't think it will be possible
to have separate data and gui presentation LC_NUMERIC locales without
custom file IO functions.

Bill
  

-- 
--------------------------------------------------
                              Mike Jarabek
                                FPGA/ASIC Designer
 http://www.istop.com/~mjarabek
--------------------------------------------------