-
0e1ea4e4
by Francis De Brabandere at 2026-04-30T16:25:26+02:00
vbscript: Implement GetLocale and SetLocale functions.
-
334188e2
by Francis De Brabandere at 2026-04-30T16:25:26+02:00
vbscript: Use script LCID in Format* functions.
The SetLocale/GetLocale commit stored the new LCID on the script context
but nothing read it: FormatNumber, FormatCurrency, FormatPercent and
FormatDateTime all delegated to oleaut32 helpers that hardcode
LOCALE_USER_DEFAULT, so scripts could not actually switch their
formatting locale.
Replicate the relevant oleaut32 number/currency format logic with the
script LCID parameterized, and call GetDateFormatW / GetTimeFormatW
directly for FormatDateTime (vbGeneralDate still falls back to
VarFormatDateTime).
The thread locale is intentionally left untouched: a new test in run.c
verifies SetLocale does not leak into GetThreadLocale(). The script
LCID is passed explicitly wherever formatting needs it.
Expected Format* values in lang.vbs were captured with cscript on
Windows (LCIDs 1031/1033/1041).
-
c1af522c
by Francis De Brabandere at 2026-04-30T16:25:29+02:00
vbscript: Pass script LCID to VariantChangeType in to_string helper.
CStr and other string coercions of numeric/date variants went through
VariantChangeType(..., 0, VT_BSTR), so they always formatted with the
user default locale regardless of SetLocale. Thread the script LCID
through the to_string() helper (and the shared err_string_prop) so
conversions honor the script-level locale.
-
d23e188d
by Francis De Brabandere at 2026-04-30T16:25:31+02:00
vbscript: Pass script LCID to VariantChangeType in to_system_time helper.
Date parsing in the Day/Month/Year/Hour/Minute/Second/Weekday/DateAdd
built-ins went through VariantChangeType(..., 0, VT_DATE), so string
inputs were always parsed with the user default locale regardless of
SetLocale. Thread the script LCID through to_system_time() so date
coercions honor the script-level locale, and use it in FormatDateTime
in place of the inline VariantCopyInd + VariantChangeTypeEx pair.