Am 13.09.2016 um 17:32 schrieb Denis Auroux: > Hi Immi, > > Yes, this is hideous, I agree. The issue at this point is backwards > compatibility -- existing xournal users have .config files with > locale-dependent numeric data in it and we'd like to be able to read > them even if they upgrade to a future version that's better about > storing data in the C locale only.
I would solve that by keeping the cleanup_numeric() in the code reading the config file. > > As far as I know there aren't locales with number formats other than 1.5 > or 1,5 but I might be wrong. Anyway, as long as we rely on > cleanup_numeric() rather than properly going around locales, it does NOT > matter whether we do it when writing the file (in update_keyval() but > only for numerical keys as you suggest in your option (a)) or when > reading it (in parse_keyval_...() as we currently do) -- because > cleanup_numeric() is not locale-aware, it will not treat properly a > locale in which 1.5 would be 1'5 and using it at write-time rather than > at read-time doesn't fix the issue. Any discrepancy between the locale > used at save time and that used at load time is irrelevant since we > clean up keys using a fixed algorithm rather than using a locale > conversion, and which locale the file is written in only matters for > aesthetics, not for real life. Ok, I agree. > (Of course if cleanup_numeric() is replaced by something that does > genuine locale conversion rather than the naive algorithm, then it > becomes very important to be in the right locale and we can't assume > that file written in one locale will be read back in the same locale). > > But you are right that it would be much cleaner to use (b) or (c) -- > print the numbers in the C locale when writing the config file. And any > locale-switching needs to be done independently when printing the > number, not all around the config file writing code, because there are > translated strings in there for the descriptions of the parameters. > > (By the way, there's similar issues with xoj files -- right now we write > it all out in the C locale, but there used to be issues with floating > point numbers e.g. stroke coordinates etc. in the xoj file. There's some > cleanup_numeric() there too since past versions of xournal were careless > about it, and it will have to stay.) > > Honestly, in my opinion this is not worth fixing for now, until someone > actually encounters a problem caused by it. Well, as I wrote, I did have a problem: The new config files are not compatible to xournal versions which don't use cleanup_numeric() after reading them. And it's probably not entirely uncommon to use the same config file with different xournal versions, namely when the home directory is mounted from some server. (Of course, now it's done: there are different xournal versions with incompatible config files; however, one could reduce the impact if newer xournal versions are compatible to old ones again.) > (And I take the view that the config file should be user-editable, since > there are many parameters with no UI to modify them; to that effect the > comments explaining what each key does is localized and so on. For that > reason having numbers be in the user's favorite format is not a stupid > idea. ... but even though I'm German, I'm horrified of typing "1,5" into a file which is supposed to be read by a computer ;-) > Of course I didn't extend the same courtesy to booleans or > keywords, e.g. "true"/"false" are not translated.) I guess the different-xournal-versions-using-same-config-file is the strongest argument I have (unless one also counts "I'm horrified of 1,5", which probably is my real motivation ;-) ). If you think that argument is not strong enough, then let's leave it as it is. Best, Immi ------------------------------------------------------------------------------ _______________________________________________ Xournal-devel mailing list Xournal-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xournal-devel