Ah, so it's calling EnumSystemLocales(). Interestingly, the documentation for that function says:
"Note For interoperability reasons, the application should prefer the EnumSystemLocalesEx function to EnumSystemLocales because Microsoft is migrating toward the use of locale names instead of locale identifiers for new locales. Any application that will be run only on Windows Vista and later should use EnumSystemLocalesEx."
That seems to be talking about this exact issue, that we're supposed to be using "locale names". I'm a little confused about the terminology for the various types of names and identifiers but if you follow the link to a example program[1] you can see that it's talking about the BCP47 "en-US" kind, that we want. (That quote makes it sound like a new thing, but Vista came out ~17 years ago.)
Vista is when they added support for BCP47, but of course, back when that code was written we were primarily supporting older versions of Windows still, back to Windows 2000 iirc.
yes, that's right. In existing branches, will replacing the EnumSystemLocales() with EnumSystemLocalesEx() plus the source code path being worked upon by Thomas fix the issue? Can give it a try
So one idea would be that in v18, we not only change initdb.exe to pick a BCP47 locale name by default as I proposed in that other thread[2], but also in the v18 version of the EDB installer you consider switching that code over to EnumSystemLocalesEx(). Then we can start to kiss goodbye to the bad old names. People would still propagate them into the future with pg_upgrade I guess, and it'd be up to users to replace them by updating their catalogs manually. Does that make sense?
Yes, it does (spitballing: might be nice if we could automatically update the catalogs as well).