Append domain_name in pages title

This commit is contained in:
Grégory Soutadé 2014-12-19 17:50:45 +01:00
parent d47a4609d8
commit ea32f7f0ae
4 changed files with 189 additions and 143 deletions

View File

@ -27,6 +27,12 @@ import logging
# Create output HTML files # Create output HTML files
# #
# Just for detection
def _(name): pass
_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July')
_('August'), _('September'), _('October'), _('November'), _('December')
del _
class DisplayHTMLRaw(object): class DisplayHTMLRaw(object):
def __init__(self, iwla, html=u''): def __init__(self, iwla, html=u''):
@ -370,6 +376,12 @@ def generateHTMLLink(url, name=None, max_length=100, prefix=u'http'):
return u'<a href="%s">%s</a>' % (url, name[:max_length]) return u'<a href="%s">%s</a>' % (url, name[:max_length])
def createCurTitle(iwla, title): def createCurTitle(iwla, title):
title = iwla._(title) + time.strftime(u' - %B %Y', iwla.getCurTime()) title = iwla._(title)
month_name = time.strftime(u'%B', iwla.getCurTime())
year = time.strftime(u'%Y', iwla.getCurTime())
title += u' - %s %s' % (iwla._(month_name), year)
domain_name = iwla.getConfValue('domain_name', '')
if domain_name:
title += u' - %s' % (domain_name)
return title return title

312
iwla.pot
View File

@ -4,242 +4,276 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iwla\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2014-12-16 21:36+CET\n" "POT-Creation-Date: 2014-12-19 17:46+CET\n"
"PO-Revision-Date: 2014-12-17 19:07+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Soutadé <soutade@gmail.com>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: iwla <iwla>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en\n"
"X-Generator: Poedit 1.6.10\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: iwla.py:343
msgid "Statistics" #: display.py:32
msgid "April"
msgstr "" msgstr ""
#: iwla.py:349 #: display.py:32
msgid "By day" msgid "February"
msgstr "" msgstr ""
#: iwla.py:349 #: display.py:32
msgid "Day" msgid "January"
msgstr "" msgstr ""
#: iwla.py:349 iwla.py:402 #: display.py:32
msgid "Not viewed Bandwidth"
msgstr ""
#: iwla.py:349 iwla.py:402
msgid "Visits"
msgstr ""
#: iwla.py:349 iwla.py:402 plugins/display/all_visits.py:51
#: plugins/display/referers.py:78 plugins/display/referers.py:118
#: plugins/display/top_downloads.py:74 plugins/display/top_visitors.py:53
msgid "Hits"
msgstr ""
#: iwla.py:349 iwla.py:402 plugins/display/all_visits.py:51
#: plugins/display/referers.py:78 plugins/display/referers.py:118
#: plugins/display/top_visitors.py:53
msgid "Pages"
msgstr ""
#: iwla.py:349 iwla.py:402 plugins/display/all_visits.py:51
#: plugins/display/top_visitors.py:53
msgid "Bandwidth"
msgstr ""
#: iwla.py:386
msgid "Average"
msgstr ""
#: iwla.py:391 iwla.py:429
msgid "Total"
msgstr ""
#: iwla.py:400
msgid "Apr"
msgstr ""
#: iwla.py:400
msgid "Aug"
msgstr ""
#: iwla.py:400
msgid "Dec"
msgstr ""
#: iwla.py:400
msgid "Feb"
msgstr ""
#: iwla.py:400
msgid "Jan"
msgstr ""
#: iwla.py:400
msgid "July" msgid "July"
msgstr "" msgstr ""
#: iwla.py:400 #: display.py:32
msgid "March"
msgstr ""
#: display.py:32 iwla.py:428
msgid "June" msgid "June"
msgstr "" msgstr ""
#: iwla.py:400 #: display.py:32 iwla.py:428
msgid "Mar"
msgstr ""
#: iwla.py:400
msgid "May" msgid "May"
msgstr "" msgstr ""
#: iwla.py:400 #: display.py:33
msgid "August"
msgstr ""
#: display.py:33
msgid "December"
msgstr ""
#: display.py:33
msgid "November"
msgstr ""
#: display.py:33
msgid "October"
msgstr ""
#: display.py:33
msgid "September"
msgstr ""
#: iwla.py:371
msgid "Statistics"
msgstr ""
#: iwla.py:377
msgid "By day"
msgstr ""
#: iwla.py:377
msgid "Day"
msgstr ""
#: iwla.py:377 iwla.py:430
msgid "Not viewed Bandwidth"
msgstr ""
#: iwla.py:377 iwla.py:430
msgid "Visits"
msgstr ""
#: iwla.py:377 iwla.py:430 plugins/display/all_visits.py:70
#: plugins/display/referers.py:95 plugins/display/referers.py:153
#: plugins/display/top_downloads.py:97 plugins/display/top_visitors.py:72
msgid "Hits"
msgstr ""
#: iwla.py:377 iwla.py:430 plugins/display/all_visits.py:70
#: plugins/display/referers.py:95 plugins/display/referers.py:153
#: plugins/display/top_visitors.py:72
msgid "Pages"
msgstr ""
#: iwla.py:377 iwla.py:430 plugins/display/all_visits.py:70
#: plugins/display/top_visitors.py:72
msgid "Bandwidth"
msgstr ""
#: iwla.py:414
msgid "Average"
msgstr ""
#: iwla.py:419 iwla.py:457
msgid "Total"
msgstr ""
#: iwla.py:428
msgid "Apr"
msgstr ""
#: iwla.py:428
msgid "Aug"
msgstr ""
#: iwla.py:428
msgid "Dec"
msgstr ""
#: iwla.py:428
msgid "Feb"
msgstr ""
#: iwla.py:428
msgid "Jan"
msgstr ""
#: iwla.py:428
msgid "Jul"
msgstr ""
#: iwla.py:428
msgid "Mar"
msgstr ""
#: iwla.py:428
msgid "Nov" msgid "Nov"
msgstr "" msgstr ""
#: iwla.py:400 #: iwla.py:428
msgid "Oct" msgid "Oct"
msgstr "" msgstr ""
#: iwla.py:400 #: iwla.py:428
msgid "Sep" msgid "Sep"
msgstr "" msgstr ""
#: iwla.py:401 #: iwla.py:429
msgid "Summary" msgid "Summary"
msgstr "" msgstr ""
#: iwla.py:402 #: iwla.py:430
msgid "Month" msgid "Month"
msgstr "" msgstr ""
#: iwla.py:402 #: iwla.py:430
msgid "Visitors" msgid "Visitors"
msgstr "" msgstr ""
#: iwla.py:402 iwla.py:412 #: iwla.py:430 iwla.py:440
msgid "Details" msgid "Details"
msgstr "" msgstr ""
#: iwla.py:436 #: iwla.py:465
msgid "Statistics for" msgid "Statistics for"
msgstr "" msgstr ""
#: iwla.py:443 #: iwla.py:472
msgid "Last update" msgid "Last update"
msgstr "" msgstr ""
#: plugins/display/all_visits.py:45 plugins/display/all_visits.py:73 #: plugins/display/all_visits.py:70 plugins/display/top_visitors.py:72
msgid "All visits"
msgstr ""
#: plugins/display/all_visits.py:51 plugins/display/top_visitors.py:53
msgid "Host" msgid "Host"
msgstr "" msgstr ""
#: plugins/display/all_visits.py:51 plugins/display/top_visitors.py:53 #: plugins/display/all_visits.py:70 plugins/display/top_visitors.py:72
msgid "Last seen" msgid "Last seen"
msgstr "" msgstr ""
#: plugins/display/all_visits.py:74 plugins/display/top_visitors.py:53 #: plugins/display/all_visits.py:92
msgid "All visits"
msgstr ""
#: plugins/display/all_visits.py:93 plugins/display/top_visitors.py:72
msgid "Top visitors" msgid "Top visitors"
msgstr "" msgstr ""
#: plugins/display/referers.py:72 plugins/display/referers.py:78 #: plugins/display/referers.py:95
msgid "Connexion from" msgid "Connexion from"
msgstr "" msgstr ""
#: plugins/display/referers.py:78 plugins/display/referers.py:118 #: plugins/display/referers.py:95 plugins/display/referers.py:153
msgid "Origin" msgid "Origin"
msgstr "" msgstr ""
#: plugins/display/referers.py:82 plugins/display/referers.py:121 #: plugins/display/referers.py:99 plugins/display/referers.py:156
msgid "Search Engine" msgid "Search Engine"
msgstr "" msgstr ""
#: plugins/display/referers.py:91 plugins/display/referers.py:132 #: plugins/display/referers.py:110 plugins/display/referers.py:125
msgid "External URL" #: plugins/display/referers.py:140 plugins/display/referers.py:163
msgstr "" #: plugins/display/referers.py:174 plugins/display/referers.py:185
#: plugins/display/referers.py:222 plugins/display/top_downloads.py:83
#: plugins/display/referers.py:100 plugins/display/referers.py:143 #: plugins/display/top_downloads.py:103 plugins/display/top_hits.py:82
msgid "External URL (robot)" #: plugins/display/top_hits.py:103 plugins/display/top_pages.py:82
msgstr "" #: plugins/display/top_pages.py:102 plugins/display/top_visitors.py:92
#: plugins/display/referers.py:112
msgid "Top Referers"
msgstr ""
#: plugins/display/referers.py:114
msgid "All Referers"
msgstr ""
#: plugins/display/referers.py:128 plugins/display/referers.py:139
#: plugins/display/referers.py:150 plugins/display/referers.py:187
#: plugins/display/top_downloads.py:80 plugins/display/top_hits.py:79
#: plugins/display/top_pages.py:79 plugins/display/top_visitors.py:73
msgid "Others" msgid "Others"
msgstr "" msgstr ""
#: plugins/display/referers.py:158 #: plugins/display/referers.py:114 plugins/display/referers.py:167
msgid "Key Phrases" msgid "External URL"
msgstr "" msgstr ""
#: plugins/display/referers.py:165 plugins/display/referers.py:175 #: plugins/display/referers.py:129 plugins/display/referers.py:178
msgid "External URL (robot)"
msgstr ""
#: plugins/display/referers.py:147
msgid "Top Referers"
msgstr ""
#: plugins/display/referers.py:149
msgid "All Referers"
msgstr ""
#: plugins/display/referers.py:200 plugins/display/referers.py:210
msgid "Top key phrases" msgid "Top key phrases"
msgstr "" msgstr ""
#: plugins/display/referers.py:165 plugins/display/referers.py:181 #: plugins/display/referers.py:200 plugins/display/referers.py:216
msgid "Key phrase" msgid "Key phrase"
msgstr "" msgstr ""
#: plugins/display/referers.py:165 plugins/display/referers.py:181 #: plugins/display/referers.py:200 plugins/display/referers.py:216
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: plugins/display/referers.py:177 #: plugins/display/referers.py:212
msgid "All key phrases" msgid "All key phrases"
msgstr "" msgstr ""
#: plugins/display/top_downloads.py:51 plugins/display/top_downloads.py:54 #: plugins/display/top_downloads.py:71
#: plugins/display/top_downloads.py:68
msgid "All Downloads"
msgstr ""
#: plugins/display/top_downloads.py:54
msgid "Hit" msgid "Hit"
msgstr "" msgstr ""
#: plugins/display/top_downloads.py:54 plugins/display/top_downloads.py:74 #: plugins/display/top_downloads.py:71 plugins/display/top_downloads.py:91
#: plugins/display/top_hits.py:54 plugins/display/top_hits.py:73 msgid "All Downloads"
#: plugins/display/top_pages.py:54 plugins/display/top_pages.py:73 msgstr ""
#: plugins/display/top_downloads.py:71 plugins/display/top_downloads.py:97
#: plugins/display/top_hits.py:71 plugins/display/top_hits.py:97
#: plugins/display/top_pages.py:71 plugins/display/top_pages.py:96
msgid "URI" msgid "URI"
msgstr "" msgstr ""
#: plugins/display/top_downloads.py:66 #: plugins/display/top_downloads.py:89
msgid "Top Downloads" msgid "Top Downloads"
msgstr "" msgstr ""
#: plugins/display/top_hits.py:49 plugins/display/top_hits.py:54 #: plugins/display/top_hits.py:71 plugins/display/top_hits.py:91
#: plugins/display/top_hits.py:67
msgid "All Hits" msgid "All Hits"
msgstr "" msgstr ""
#: plugins/display/top_hits.py:54 plugins/display/top_hits.py:73 #: plugins/display/top_hits.py:71 plugins/display/top_hits.py:97
#: plugins/display/top_pages.py:54 plugins/display/top_pages.py:73 #: plugins/display/top_pages.py:71 plugins/display/top_pages.py:96
msgid "Entrance" msgid "Entrance"
msgstr "" msgstr ""
#: plugins/display/top_pages.py:49 plugins/display/top_pages.py:54 #: plugins/display/top_pages.py:71 plugins/display/top_pages.py:90
#: plugins/display/top_pages.py:67
msgid "All Pages" msgid "All Pages"
msgstr "" msgstr ""
#: plugins/display/top_pages.py:65 #: plugins/display/top_pages.py:88
msgid "Top Pages" msgid "Top Pages"
msgstr "" msgstr ""

View File

@ -368,7 +368,7 @@ class IWLA(object):
def _generateDisplayDaysStats(self): def _generateDisplayDaysStats(self):
cur_time = self.meta_infos['last_time'] cur_time = self.meta_infos['last_time']
title = '%s %d/%02d' % (self._('Statistics'), cur_time.tm_year, cur_time.tm_mon) title = createCurTitle(self, self._('Statistics'))
filename = self.getCurDisplayPath('index.html') filename = self.getCurDisplayPath('index.html')
self.logger.info('==> Generate display (%s)' % (filename)) self.logger.info('==> Generate display (%s)' % (filename))
page = self.display.createPage(title, filename, conf.css_path) page = self.display.createPage(title, filename, conf.css_path)
@ -425,7 +425,7 @@ class IWLA(object):
def _generateDisplayMonthStats(self, page, year, month_stats): def _generateDisplayMonthStats(self, page, year, month_stats):
cur_time = time.localtime() cur_time = time.localtime()
months_name = ['', self._('Jan'), self._('Feb'), self._('Mar'), self._('Apr'), self._('May'), self._('June'), self._('July'), self._('Aug'), self._('Sep'), self._('Oct'), self._('Nov'), self._('Dec')] months_name = ['', self._('Jan'), self._('Feb'), self._('Mar'), self._('Apr'), self._('May'), self._('June'), self._('Jul'), self._('Aug'), self._('Sep'), self._('Oct'), self._('Nov'), self._('Dec')]
title = '%s %d' % (self._('Summary'), year) title = '%s %d' % (self._('Summary'), year)
cols = [self._('Month'), self._('Visitors'), self._('Visits'), self._('Pages'), self._('Hits'), self._('Bandwidth'), self._('Not viewed Bandwidth'), self._('Details')] cols = [self._('Month'), self._('Visitors'), self._('Visits'), self._('Pages'), self._('Hits'), self._('Bandwidth'), self._('Not viewed Bandwidth'), self._('Details')]
graph_cols=range(1,7) graph_cols=range(1,7)

View File

@ -61,7 +61,7 @@ class IWLADisplayAllVisits(IPlugin):
last_access = sorted(hits.values(), key=lambda t: t['last_access'], reverse=True) last_access = sorted(hits.values(), key=lambda t: t['last_access'], reverse=True)
title = time.strftime(self.iwla._(u'All visits') + u' - %B %Y', self.iwla.getCurTime()) title = createCurTitle(self.iwla, u'All visits')
filename = 'all_visits.html' filename = 'all_visits.html'
path = self.iwla.getCurDisplayPath(filename) path = self.iwla.getCurDisplayPath(filename)