[Patches] [ python-Patches-401842 ] Localization of calendar module.

noreply@sourceforge.net noreply@sourceforge.net
Tue, 22 May 2001 08:58:52 -0700


Patches item #401842, was updated on 2000-10-09 01:23
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=401842&group_id=5470

Category: library
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Denis S. Otkidach (ods)
Assigned to: Barry Warsaw (bwarsaw)
Summary: Localization of calendar module.

Initial Comment:
 

----------------------------------------------------------------------

>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-05-22 08:58

Message:
Logged In: YES 
user_id=12800

Applied to calendar.py 1.22

----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-05-22 08:51

Message:
Logged In: YES 
user_id=12800

Very good point.  It seems to me the convenience of calendar
tracking changes to the locale outweighs the need to keep
the same concrete type for these undocumented variables. 
I'll apply the original patch.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-05-22 02:28

Message:
Logged In: YES 
user_id=21627

Barry, the problem with your version is that it does nothing
unless locale.setlocale has been called *before the calendar
module is imported*.
To get a version that changes when setlocale is called, you
either need to intercept locale.setlocale and update the
calender constants, or use Denis' approach.
I'm not sure whether it is really required that the
constants stay current even after setlocale calls; if
Barry's patch is used, it should be documented that
setlocale must be called before calendar is imported to make
use of the locale-specific constants.
Re-assigned back to Barry.

----------------------------------------------------------------------

Comment By: Denis S. Otkidach (ods)
Date: 2001-05-22 01:48

Message:
Logged In: YES 
user_id=63454

When using real list objects we need to set locale before
*importing* the module. I'm not sure this is a good
solution. Such feature should be properly documented at
least.

----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-05-21 14:11

Message:
Logged In: YES 
user_id=12800

Sorry for leaving this patch unreviewed for so long.

Attached is a slightly different approach which retains the
property that day_name, day_abbr, month_name, and month_abbr
are actually list objects of the same size as before the
patch.  I don't know if this is a property worth keeping,
since those variables aren't described in the library manual
(but OTOH aren't prefixed with and underscore to
deliberately mark them as private to the module).

The only testing I've done is to make sure that that stuff
is the same on my `en' Linux box.  I haven't got any way to
test them for other locales, and there's no test suite for
the calendar module.

I'm assigning to Martin for his opinion.  Martin, if it
looks okay to you, reassign to me and I'll commit the
changes.  Thanks.


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2000-10-09 05:46

Message:
This seems a little too much code while we're in a feature freeze. Let's do this after 2.0final is released.

----------------------------------------------------------------------

Comment By: Denis S. Otkidach (ods)
Date: 2000-10-09 01:34

Message:
This work fine for all locales on NT, but may work a bit strange with some locales (e.g. ru_RU) on some platforms with buggy (IMHO) L10n of strftime (e.g. RedHat Linux).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=401842&group_id=5470