Added locale.setlocale and related changes

locale is set from the default LANG env variable
This commit is contained in:
Oğuz Yarımtepe 2008-12-17 20:44:42 +00:00
parent 869a7e0866
commit 8aa18bf4cb
3 changed files with 12 additions and 2 deletions

View File

@ -27,7 +27,7 @@
<TMPL_IF content> <TMPL_IF content>
<content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded> <content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded>
</TMPL_IF> </TMPL_IF>
<dc:date><TMPL_VAR date_iso></dc:date> <dc:date><TMPL_VAR date_822></dc:date>
<TMPL_IF creator> <TMPL_IF creator>
<dc:creator><TMPL_VAR creator></dc:creator> <dc:creator><TMPL_VAR creator></dc:creator>
</TMPL_IF> </TMPL_IF>

View File

@ -19,7 +19,7 @@
</TMPL_IF> </TMPL_IF>
<TMPL_VAR content ESCAPE="HTML"></description> <TMPL_VAR content ESCAPE="HTML"></description>
</TMPL_IF> </TMPL_IF>
<pubDate><TMPL_VAR date_iso></pubDate> <pubDate><TMPL_VAR date_822></pubDate>
<TMPL_IF creator> <TMPL_IF creator>
<dc:creator><TMPL_VAR creator></dc:creator> <dc:creator><TMPL_VAR creator></dc:creator>
</TMPL_IF> </TMPL_IF>

View File

@ -12,6 +12,7 @@ __authors__ = [ "Scott James Remnant <scott@netsplit.com>",
"Jeff Waugh <jdub@perkypants.org>" ] "Jeff Waugh <jdub@perkypants.org>" ]
__license__ = "Python" __license__ = "Python"
import locale
# Modules available without separate import # Modules available without separate import
import cache import cache
@ -87,6 +88,15 @@ class stripHtml(sgmllib.SGMLParser):
def template_info(item, date_format): def template_info(item, date_format):
"""Produce a dictionary of template information.""" """Produce a dictionary of template information."""
info = {} info = {}
#set the locale so that the dates at the feeds will be in english
lc=locale.getlocale()
if lc[0].find("tr") != -1:
try:
locale.setlocale(locale.LC_ALL, '')
except:
pass
for key in item.keys(): for key in item.keys():
if item.key_type(key) == item.DATE: if item.key_type(key) == item.DATE:
date = item.get_as_date(key) date = item.get_as_date(key)