|
From: Jan N. <jan...@gm...> - 2025-12-30 21:32:23
|
Op za 27 dec 2025 om 15:02 schreef apnmbx-public--- via Tcl-Core
<tcl...@li...>:
>
> TIP 744: Support for long paths on Windows is ready for review.
Well, there's one thing I don't like about the TIP: The error-messages
generated are
always in the current locale, not in en_US. And there is no
possibility to change that.
In my view it was always a mistake that the registry extension
produced localized
error-messages, unlike any other extension. This can be seen by the test-suite:
if the locale is not 'en', many registry testcases are skipped. The
standard 'Tcl'
way is using msgcat to translate messages to other languages for display.
The minimum which should happen is add a "locale" parameter to the functions.
The default should be "en_US" (or "C", if you want, that's actually the same).
I made a simple start in the "tip-744-with-locale" branch, still unfinished
but you get the idea. The function LocaleNameToLCID() can be used to
translate from locale name to LCID.
The second thing which is wrong iIMHO is the handling of the
messageDll parameter. It should be in UTF-8 (like all other parameters),
but it is input directly into LoadLibraryExA(). If a full path is used, which
contains non-ASCII characters this won't work. Also, I don't think it
works with a dll coming from a VFS (I don't see a test-case for that,
but since LoadLibraryExA() doesn't know about the VFS, I'm
sure it won't work).
Finally, the errorCode parameter of Tcl_WinRaiseError() and the messageId
parameter of Tcl_WinAppendMessageFromModule() are actually the
same thing. Why not call them 'messageId' in both functions? That's
how Microsoft names the third FormatMessageW() parameter,
which is also the same thing.
It also would be nice when the UNIX and MacOS builds still work, and
everything compiles without warnings. I committed fixes for that in
the "tip-744" branch, that's less work for me than discussing it here.
Conclusion: still work to be done .... A YES vote for the TIP as it is now
expresses an OK for extensions to output localized error-messages.
I don't think that's OK, it should not be encouraged.
Regards,
Jan Nijtmans
|