Replace g.gettext by iwla._
Add createCurTitle() to factorize code
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
import gettext as g
|
||||
|
||||
from iwla import IWLA
|
||||
from iplugin import IPlugin
|
||||
@@ -42,13 +41,13 @@ class IWLADisplayAllVisits(IPlugin):
|
||||
|
||||
last_access = sorted(hits.values(), key=lambda t: t['last_access'], reverse=True)
|
||||
|
||||
title = time.strftime(g.gettext('All visits') + ' - %B %Y', self.iwla.getCurTime())
|
||||
title = time.strftime(self.iwla._(u'All visits') + u' - %B %Y', self.iwla.getCurTime())
|
||||
|
||||
filename = 'all_visits.html'
|
||||
path = self.iwla.getCurDisplayPath(filename)
|
||||
|
||||
page = display.createPage(title, path, self.iwla.getConfValue('css_path', []))
|
||||
table = display.createBlock(DisplayHTMLBlockTable, g.gettext('Last seen'), [g.gettext('Host'), g.gettext('Pages'), g.gettext('Hits'), g.gettext('Bandwidth'), g.gettext('Last seen')])
|
||||
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Last seen'), [self.iwla._(u'Host'), self.iwla._(u'Pages'), self.iwla._(u'Hits'), self.iwla._(u'Bandwidth'), self.iwla._(u'Last seen')])
|
||||
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', ''])
|
||||
|
||||
for super_hit in last_access:
|
||||
@@ -70,8 +69,8 @@ class IWLADisplayAllVisits(IPlugin):
|
||||
display.addPage(page)
|
||||
|
||||
index = self.iwla.getDisplayIndex()
|
||||
link = '<a href=\'%s\'>%s</a>' % (g.gettext('All visits'), filename)
|
||||
block = index.getBlock(g.gettext('Top visitors'))
|
||||
link = '<a href=\'%s\'>%s</a>' % (filename, self.iwla._(u'All visits'))
|
||||
block = index.getBlock(self.iwla._(u'Top visitors'))
|
||||
if block:
|
||||
block.setTitle('%s - %s' % (block.getTitle(), link))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user