Add support for locale-switching on Windows.

This addresses an issue mentioned in relation to #1696.