maoserr / redshiftgui

Monitor color temperature adjustment tool
http://maoserr.github.io/projects/redshiftgui/
GNU General Public License v3.0
231 stars 28 forks source link

locale issue #6

Closed voidzero closed 10 years ago

voidzero commented 12 years ago

I think there is a locale issue that causes some problems, for example with the latitude / longitude.

Some locales (e.g. in Europe) write "two thousand and one half" as "2.000,5", other locales (e.g. the US) write it as "2,000.5". It seems that redshiftgui does not take this in consideration...

maoserr commented 10 years ago

Yea, sorry, I don't know anything about other countries. Is there a simple solution to this, without having to rewrite a lot of code?

naszar commented 10 years ago

Problem is that you use ',' as separator in map parameter of .redshift grc. Any other symbol will solve problem. [ in opt_write_config() (src/options.c:448) you use system LC_NUMERIC, but in opt_parse_map() (src/options.c:334) you forgot that *localeconv()->decimal_point may be ','. This (https://gist.github.com/naszar/60207b603bf66d699203 ) may be quick but not accurate fix.

naszar commented 10 years ago

Sorry, but my previous patch is not complete. This one (https://gist.github.com/naszar/e5902e341467935ce383) is are tested and completely solve issue with locales.

maoserr commented 10 years ago

Thanks for this, did you test this on linux and win32 side? I'm recently upgraded comps and haven't had time to install linux yet. I'll get this incorporated once I do that.

naszar commented 10 years ago

Yes, I test it. I use ArchLinux x64 and currently, redshiftgui compiled from your git repo, but I can test binary if you want.

I'm doubt about win32. Switching of locales is side effect of gtk. And I can help only with linux version.I now nothing about win32 locales.. maybe setlocale(LC_NUMERIC,"") will make windows version broken.. maybe #ifndef _WIN32 help?

And, sorry for first broken patch.. only when I make some fixes for your code (to compile it.. yes, source at github is broken) and run it, I found that locale not switched in moment of reading config.

maoserr commented 10 years ago

Ok thanks. Source is broken for linux? Do you know what the problem is? I guess I'll have to hurry up and install Arch.

naszar commented 10 years ago

https://gist.github.com/naszar/7ccf78f770e90d335011

Yes, there are build errors in linux version. I'm not sure in my CMakeLists.txt fixes for finding mathlib and includes for iup, but with this patch I can build your program.

maoserr commented 10 years ago

Please check to see if the 0.2.4 fixes the locale issue.

naszar commented 10 years ago

I have tested git version and it works fine with locales for me. And builds - thank you.

maoserr commented 10 years ago

k, I will publish the releases shortly