Adapt planetplanet with French settings
Today I hacked a little bit on planet in oder to suit with French settings such as timezone and dates.
I modified two files planet.py and planetlib.py. I had trouble to display dates in my timezone. The only solution I found was to add (3600 * 2) seconds to the current UTC time. (In France we are living at GMT+2 in summer)
--- planet-nightly/planet.py 2004-10-01 20:03:20.000000000 +0200
+++ planet.py 2005-06-03 14:31:05.000000000 +0200
@@ -14,6 +14,9 @@
import sys
import time
import os
+import locale
+locale.setlocale(locale.LC_ALL, 'fr_FR')
+
try:
import logging
@@ -43,7 +46,7 @@
OUTPUT_DIR = 'output'
ITEMS_PER_PAGE = 60
DAYS_PER_PAGE = 0
-DATE_FORMAT = '%B %d, %Y %I:%M %p'
+DATE_FORMAT = '%d %B %Y %H:%M %p'
LOG_LEVEL = 'WARNING'
@@ -218,7 +221,7 @@
if days_passed >= days_per_page:
continue
- info["new_date"] = time.strftime("%B %d, %Y", date)
+ info["new_date"] = time.strftime("%d %B %Y", date)
prev_date = date[:3]
else:
info["new_date"] = ""
--- planet-nightly/planetlib.py 2004-10-01 20:03:20.000000000 +0200
+++ planetlib.py 2005-06-03 14:31:35.000000000 +0200
@@ -23,6 +23,10 @@
import feedparser
import StringIO
import sgmllib
+import locale
+locale.setlocale(locale.LC_ALL, 'fr_FR')
+
+
try:
import logging
@@ -321,7 +325,8 @@
# self.offset is the difference from UTC, so add timezone
offset += self.offset * 3600 + time.timezone
- return time.mktime(date) - offset
+ return time.mktime(date) - offset + 3600 * 2
+
def format_date(self, date, fmt=None):
"""Formats a date for output.
June 3rd, 2005 at 11:43 pm
Et le changement pour la langue Française a été adapté pour planet.tuxfamily.org …
Merci