programmatically change windows regional settings?
Albert-Jan Roskam
fomcl at yahoo.com
Sun May 24 10:16:20 EDT 2015
-----------------------------
On Sun, May 24, 2015 3:07 PM CEST Mark Lawrence wrote:
>On 24/05/2015 13:50, Albert-Jan Roskam via Python-list wrote:
>>
>> Hi,
>>
>> In Windows I can change the regional settings manually in the control panel. But how do I do this programmatically? I tried setting LANG but this does not work in Windows.
>>
>> Kernel32's SetLocaleInfo sounds promising, but "This setting only affects the user override portion of the locale settings; it does not set the system defaults." https://msdn.microsoft.com/en-us/library/ee491893(v=winembedded.60).aspx
>>
>> Another route might be _winreg (but that's probably more brittle and, more importantly, the registry sucks)
>>
>> My goal is to easily run my unittests in a number of locales (actually a platform x locale x python version matrix)
>>
>> Thanks!
>>
>> Albert-Jan
>>
>
>You're probably better off asking this on
>https://mail.python.org/mailman/listinfo/python-win32 which is also
>available as gmane.comp.python.windows, although you might get lucky
>here.
Ok, I'll check that out, thanks. Hope that list is about more than win32com
If you do a rather more specific statement than "this does not
>work in Windows" would be helpful.
One can set LANG in Windows (of course), but Windows does not appear to ever use it. So it's pointless.
setx LANG France.French.1252 && python -c "from locale import *; setlocale(LC_ALL, ''); print(getlocale())"
... Does not print a French locale on my non-French system
>Your Python and Windows version(s)
>might possibly assist as well :)
Windows Server 2012 R2 (x64), and preferably also Win 7 x64. Python 2.7, 3.3, 3.4, and ideally also pypy.
>--
>My fellow Pythonistas, ask not what our language can do for you, ask
>what you can do for our language.
>
>Mark Lawrence
>
>--
>https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list