Portable locale usage

Siniša Šegvić ssegvic at zemris.fer.hr
Wed Sep 7 14:33:57 EDT 2011

> From: "Laszlo Nagy" <gandalf at shopzeus.com>
> To: "ssegvic" <sinisa.segvic at fer.hr>, python-list at python.org
> Sent: Wednesday, September 7, 2011 4:51:20 PM
> Subject: Re: Portable locale usage
> > 1. Is there a way for writing portable Python code dealing with
> > locales (as sketched in the beginning)?
> I usually do this at the top of my main program, before importing
> other modules:
> import locale
> locale.setlocale(locale.LC_ALL, '')

I have set the system-wide locale to Croatian (Croatia) 
on my development system as instructed by:

Nevertheless, your proposal produces: 
('English_United States','1252')

Note that I would very much like 
to avoid changing the system locale
(this requires Administrator password and system restart).

Setting the locale for my program only would be interesting,
but AFAIK this can not be done on Windows (?).

> Why are you trying to force a specific locale to your program anyway?

Because I wish to be able to correctly sort Croatian names.

I expect that most of my Windows users will not care 
to configure their computers with the national locale 
(and besides, that does not seem to work, anyway).



More information about the Python-list mailing list