# HG changeset patch # User palgarvio # Date 1181678238 0 # Node ID fb9109dd9070ffbaf93ff00a30ad2961d3025868 # Parent debd9ac3bb4d2a93c3166c964101e0235687ec74 Also use tzinfo for `write_po`. diff --git a/babel/messages/pofile.py b/babel/messages/pofile.py --- a/babel/messages/pofile.py +++ b/babel/messages/pofile.py @@ -25,10 +25,10 @@ except NameError: from sets import Set as set import textwrap -import time from babel import __version__ as VERSION from babel.messages.catalog import Catalog +from babel.util import LOCAL __all__ = ['escape', 'normalize', 'read_po', 'write_po', 'write_pot'] @@ -304,7 +304,7 @@ if omit_header: continue _write(POT_HEADER % { - 'year': time.strftime('%Y'), + 'year': date.today().strftime('%Y'), 'project': project, 'copyright_holder': _copyright_holder, }) @@ -418,6 +418,7 @@ inlines = input_fileobj.readlines() outlines = [] in_header = True + _date = datetime.now(LOCAL) for index in range(len(inlines)): if in_header: if '# Translations template' in inlines[index]: @@ -426,14 +427,14 @@ elif '# FIRST AUTHOR , YEAR.' in inlines[index]: if _first_author: outlines.append( - '# %s, %s\n' % (_first_author, time.strftime('%Y')) + '# %s, %s\n' % (_first_author, _date.strftime('%Y')) ) else: outlines.append(inlines[index]) elif '"PO-Revision-Date:' in inlines[index]: outlines.append( '"PO-Revision-Date: %s\\n"\n' % \ - time.strftime('%Y-%m-%d %H:%M%z') + _date.strftime('%Y-%m-%d %H:%M%z') ) elif '"Last-Translator:' in inlines[index]: if _first_author: