Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1d099103
Commit
1d099103
authored
May 22, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Application of patch #401842 by Denis S. Otkidach to support
localization of month and day names.
parent
d0b625d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Lib/calendar.py
Lib/calendar.py
+11
-9
No files found.
Lib/calendar.py
View file @
1d099103
...
...
@@ -8,7 +8,7 @@ set the first day of the week (0=Monday, 6=Sunday)."""
# Revision 2: uses functions from built-in time module
# Import functions and variables from time module
from
time
import
localtime
,
mktime
from
time
import
localtime
,
mktime
,
strftime
__all__
=
[
"error"
,
"setfirstweekday"
,
"firstweekday"
,
"isleap"
,
"leapdays"
,
"weekday"
,
"monthrange"
,
"monthcalendar"
,
...
...
@@ -24,17 +24,19 @@ February = 2
# Number of days per month (except for February in leap years)
mdays
=
[
0
,
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
]
class
_localized_name
:
def
__init__
(
self
,
format
):
self
.
format
=
format
def
__getitem__
(
self
,
item
):
return
strftime
(
self
.
format
,
(
item
,)
*
9
).
capitalize
()
# Full and abbreviated names of weekdays
day_name
=
[
'Monday'
,
'Tuesday'
,
'Wednesday'
,
'Thursday'
,
'Friday'
,
'Saturday'
,
'Sunday'
]
day_abbr
=
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
day_name
=
_localized_name
(
'%A'
)
day_abbr
=
_localized_name
(
'%a'
)
# Full and abbreviated names of months (1-based arrays!!!)
month_name
=
[
''
,
'January'
,
'February'
,
'March'
,
'April'
,
'May'
,
'June'
,
'July'
,
'August'
,
'September'
,
'October'
,
'November'
,
'December'
]
month_abbr
=
[
' '
,
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
]
month_name
=
_localized_name
(
'%B'
)
month_abbr
=
_localized_name
(
'%b'
)
# Constants for weekdays
(
MONDAY
,
TUESDAY
,
WEDNESDAY
,
THURSDAY
,
FRIDAY
,
SATURDAY
,
SUNDAY
)
=
range
(
7
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment