On Tue, 20 Apr 2021 19:04:35 +0200 Václav Slavík wrote:
VS> > The fact that they have provided gtk_disable_setlocale() is IMO a good
VS> > indicator that even GTK developers came to realize it was a mistake.
VS>
VS> It’s opt-out for special needs, including accommodating users like wx.
It would perhaps be flattering to think that we're important enough to
make GTK developers add functions for accommodating wx, but I don't believe
it at all. I.e. if they've added this function, it must have been because
other, much more important GTK users, have requested it.
VS> > Just to be clear: removing the call to gtk_disable_setlocale() would
VS> > definitely be wrong. We've already gone through this in 2.9.[1-4] days,
VS> > when we had decided to change the C locale by default and this broke so
VS> > many applications (because they couldn't parse the numbers or input or,
VS> > potentially even worse, produced numbers in wrong format on output) that we
VS> > had to revert this. I.e. I am absolutely against trying to do it again.
VS>
VS> Have wxUILocale be an explicit opt-in,
I really hope to use it by default. The fact that you need to do something
special in order to have wx{Calendar,DatePicker,Spin}Ctrl work correctly
doesn't seem right at all to me.
VS> then, and use C formatting otherwise. But I don’t see how can we ignore
VS> GTK+’s need for a locale.
Before I waste time on trying to make it work, could you please explain
why do you think it's hopeless? AFAICS it's going to be tricky and maybe
dirty, but doable. For wxSpinCtrl I've already done preparatory work in
https://github.com/wxWidgets/wxWidgets/pull/2334 in fact, and we can use
"input"/"output" signals to do our own formatting cleanly enough. For the
others it looks like we'll need to change the locale during their creation
but could reset it back after doing it. This is clearly bad, but still not
as bad as changing it globally, I think.
Are there any other places where GTK uses the current locale?
VS> IMHO making wxUILocale opt-in and documenting that opting in switches
VS> locale in wxGTK is the only realistic way to handle it.
This would definitely be much simpler, but it would make somewhat of a
mockery of the promise of having a portable API, if it has a globally
significant side effect on some platforms but not the others.
VS> > VS> These days that pretty much means BCP 47 language tags (fr, fr-FR,
VS> > VS> de-CH etc.). Modern macOS and Windows[*] switched to using them, web
VS> > VS> uses them, they are well defined and widely understood.
VS> >
VS> > Yes, I agree that we should use them (i.e. ISO 639 codes)
VS>
VS> It’s a bit more than just that, there’s optional ISO-3166-1 country or
VS> country region (e.g. es-419) after the ISO-639-{1,2,3} code, also
VS> optional script (sr-Latn, zh-{Hans,Hant} etc). Generally, it’s not
VS> treatable as an opaque string e.g. for translations loading.
I'll need to read this in more details then, thanks.
VS> > too, but OTOH if we don't implement changing the locale for now, the point is somewhat moot.
VS>
VS> GetPreferredUILanguages() needs to return a list of languages...
Ah, of course, you're right.
Thanks,
VZ