Move POT-Creation-Date configuration value back into code.

This commit is contained in:
Robert Lehmann 2010-06-26 12:25:53 +02:00
parent cd583b634d
commit 10fc7cd73b
2 changed files with 11 additions and 8 deletions

View File

@ -10,6 +10,7 @@
"""
import collections
from datetime import datetime
from os import path
from docutils import nodes
@ -29,7 +30,7 @@ msgid ""
msgstr ""
"Project-Id-Version: %(version)s\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: %(gettext_ctime)s\n"
"POT-Creation-Date: %(ctime)s\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -70,12 +71,20 @@ class MessageCatalogBuilder(Builder):
catalog.append(msg)
def finish(self):
data = dict(
version = self.config.version,
copyright = self.config.copyright,
project = self.config.project,
# XXX should supply tz
ctime = datetime.now().strftime('%Y-%m-%d %H:%M%z'),
)
for section, messages in self.status_iterator(
self.catalogs.iteritems(), "writing message catalogs... ",
lambda (section, _):darkgreen(section), len(self.catalogs)):
pofile = open(path.join(self.outdir, '%s.pot' % section), 'w')
try:
pofile.write(POHEADER % self.config)
pofile.write(POHEADER % data)
for message in messages:
# message contains *one* line of text ready for translation
message = message.replace(u'\\', ur'\\').replace(u'"', ur'\"')

View File

@ -11,7 +11,6 @@
import os
import re
from datetime import datetime
from os import path
from sphinx.errors import ConfigError
@ -151,11 +150,6 @@ class Config(object):
# manpage options
man_pages = ([], None),
# gettext options
gettext_ctime = (lambda self:datetime.now() # should supply tz
.strftime('%Y-%m-%d %H:%M%z'),
'gettext'),
)
def __init__(self, dirname, filename, overrides, tags):