Browse Source

Fix some more hard-coded texts in Plush.

Add i18n support to calc_age() function.
Add more translator instructions.
tags/0.6.0
ShyPike 14 years ago
parent
commit
30ed8be2c7
  1. 2
      interfaces/Plush/templates/config_rss.tmpl
  2. 4
      interfaces/Plush/templates/config_server.tmpl
  3. 2
      interfaces/Plush/templates/queue.tmpl
  4. 1092
      po/main/SABnzbd.pot
  5. 25
      sabnzbd/api.py
  6. 3
      sabnzbd/interface.py
  7. 34
      sabnzbd/skintext.py

2
interfaces/Plush/templates/config_rss.tmpl

@ -66,7 +66,7 @@
<table>
<tr><td>$T('name')</td><td><input type="text" size="10" name="feed" value="$feed"/></td></tr>
<tr><td>$T('newFeedURI')</td><td><input type="text" size="80" name="uri"/></td></tr>
<tr><td></td><td><input type="submit" class="juiButton" value="Add Feed"/></td></tr>
<tr><td></td><td><input type="submit" class="juiButton" value="T$('addFeed')"/></td></tr>
</table>
<input type="hidden" name="session" value="$session">
</form>

4
interfaces/Plush/templates/config_server.tmpl

@ -136,7 +136,7 @@
<div class="field-pair">
<label class="nocheck clearfix" for="host">
<span class="component-title">$T('srv-host')</span>
<input type="text" size="25" name="host" value="$servers[$server]['host']" />
<input type="text" size="40" name="host" value="$servers[$server]['host']" />
</label>
</div>
<div class="field-pair alt">
@ -159,7 +159,7 @@
</div>
<div class="field-pair">
<label class="nocheck clearfix" for="connections">
<span class="component-title"># $T('srv-connections')</span>
<span class="component-title">$T('srv-connections')</span>
<input type="text" size="10" name="connections" value="$servers[$server]['connections']" />
</label>
</div>

2
interfaces/Plush/templates/queue.tmpl

@ -63,7 +63,7 @@
<div class="main_sprite_container sprite_progressbar_bg">
<div class="main_sprite_container sprite_progress_done" style="background-position: -<!--#if $slot.mb == "0.00" then "120" else int(120 - 120.0 / 100.0 * int(100 - float($slot.mbleft) / float($slot.mb) * 100))#-->px -401px">
<div class="totalDownload"><!--#echo locale.format('%d', int(float($slot.mb)), True)#-->&nbsp;<small>$T('MB')</small></div>
<div class="currentDownload"><!--#if $slot.mb!=$slot.mbleft#--><!--#echo locale.format('%d', int(float($slot.mb)-float($slot.mbleft)), True)#-->&nbsp;<small>$T('MB')&nbsp;of</small><!--#end if#--></div>
<div class="currentDownload"><!--#if $slot.mb!=$slot.mbleft#--><!--#echo locale.format('%d', int(float($slot.mb)-float($slot.mbleft)), True)#-->&nbsp;<small>$T('MB')&nbsp;$T('AofB')</small><!--#end if#--></div>
</div>
</div>
</td>

1092
po/main/SABnzbd.pot

File diff suppressed because it is too large

25
sabnzbd/api.py

@ -229,6 +229,8 @@ def _api_queue_default(output, value, kwargs):
direction = kwargs.get('dir')
start = kwargs.get('start')
limit = kwargs.get('limit')
trans = kwargs.get('trans')
if output in ('xml', 'json'):
if sort and sort != 'index':
reverse = direction.lower() == 'desc'
@ -238,7 +240,7 @@ def _api_queue_default(output, value, kwargs):
history = bool(kwargs.get('history'))
info, pnfo_list, bytespersec, verbose_list, dictn = \
build_queue(history=history, start=start, limit=limit, output=output)
build_queue(history=history, start=start, limit=limit, output=output, trans=trans)
info['categories'] = info.pop('cat_list')
info['scripts'] = info.pop('script_list')
return report(output, keyword='queue', data=remove_callable(info))
@ -870,7 +872,7 @@ def handle_cat_api(output, kwargs):
#------------------------------------------------------------------------------
def build_queue(web_dir=None, root=None, verbose=False, prim=True, verbose_list=None,
dictionary=None, history=False, start=None, limit=None, dummy2=None, output=None):
dictionary=None, history=False, start=None, limit=None, dummy2=None, trans=False, output=None):
if output:
converter = unicoder
else:
@ -1003,7 +1005,7 @@ def build_queue(web_dir=None, root=None, verbose=False, prim=True, verbose_list=
datestart = datetime.datetime.now()
slot['eta'] = 'unknown'
slot['avg_age'] = calc_age(average_date)
slot['avg_age'] = calc_age(average_date, bool(trans))
slot['verbosity'] = ""
if web_dir:
finished = []
@ -1647,11 +1649,20 @@ def calc_timeleft(bytesleft, bps):
return '0:00:00'
def calc_age(date):
def calc_age(date, trans=False):
"""
Calculate the age difference between now and date.
Value is returned as either days, hours, or minutes.
When 'trans' is True, time symbols will be translated.
"""
if trans:
d = T('d') #: Single letter abbreviation of day
h = T('h') #: Single letter abbreviation of hour
m = T('m') #: Single letter abbreviation of minute
else:
d = 'd'
h = 'h'
m = 'm'
try:
now = datetime.datetime.now()
#age = str(now - date).split(".")[0] #old calc_age
@ -1662,11 +1673,11 @@ def calc_age(date):
#only one value should be returned
#if it is less than 1 day then it returns in hours, unless it is less than one hour where it returns in minutes
if dage.days:
age = '%sd' % (dage.days)
age = '%s%s' % (dage.days, d)
elif seconds/3600:
age = '%sh' % (seconds/3600)
age = '%s%s' % (seconds/3600, h)
else:
age = '%sm' % (seconds/60)
age = '%s%s' % (seconds/60, m)
except:
age = "-"

3
sabnzbd/interface.py

@ -621,7 +621,8 @@ class QueuePage(object):
limit = kwargs.get('limit')
dummy2 = kwargs.get('dummy2')
info, pnfo_list, bytespersec, self.__verbose_list, self.__dict__ = build_queue(self.__web_dir, self.__root, self.__verbose, self.__prim, self.__verbose_list, self.__dict__, start=start, limit=limit, dummy2=dummy2)
info, pnfo_list, bytespersec, self.__verbose_list, self.__dict__ = build_queue(self.__web_dir, self.__root, self.__verbose,\
self.__prim, self.__verbose_list, self.__dict__, start=start, limit=limit, dummy2=dummy2, trans=True)
template = Template(file=os.path.join(self.__web_dir, 'queue.tmpl'),
filter=FILTER, searchList=[info], compilerSettings=DIRECTIVES)

34
sabnzbd/skintext.py

@ -190,6 +190,7 @@ SKIN_TEXT = {
'purgeNZBs-Files' : TT('Purge NZBs & Delete Files'), #: Queue page button
'removeNZB' : TT('Remove NZB'), #: Queue page button
'removeNZB-Files' : TT('Remove NZB & Delete Files'), #: Queue page button
'AofB' : TT('of'), #: Queue page, as in "4G *of* 10G"
# History page
'purgeHist' : TT('Purge History'), #: History page button
@ -448,22 +449,23 @@ SKIN_TEXT = {
'newFeedURI' : TT('New Feed URL'),
'explain-RSS' : TT('The checkbox next to the feed name should be ticked for the feed to be enabled and be automatically checked for new items.<br />The checking frequency is in the General page of the configuration.<br />When a feed is added, it will only pick up new items and not anything already in the RSS feed unless you press "Force Download".'),
'feed' : TT('Feed'), #: Config->RSS, tab header
'button-delFeed' : TT('Delete Feed'),
'button-preFeed' : TT('Read Feed'),
'button-forceFeed' : TT('Force Download'),
'rss-order' : TT('Order'),
'rss-type' : TT('Type'),
'rss-filter' : TT('Filter'),
'rss-skip' : TT('Skip'),
'rss-accept' : TT('Accept'),
'rss-reject' : TT('Reject'),
'rss-must' : TT('Requires'),
'rss-mustcat' : TT('RequiresCat'),
'rss-delFilter' : TT('X'),
'rss-matched' : TT('Matched'),
'rss-notMatched' : TT('Not matched'),
'rss-done' : TT('Downloaded'),
'link-download' : TT('Download'),
'addFeed' : TT('Add Feed'), #: Config->RSS button
'button-delFeed' : TT('Delete Feed'),#: Config->RSS button
'button-preFeed' : TT('Read Feed'),#: Config->RSS button
'button-forceFeed' : TT('Force Download'),#: Config->RSS button
'rss-order' : TT('Order'), #: Config->RSS table column header
'rss-type' : TT('Type'), #: Config->RSS table column header
'rss-filter' : TT('Filter'), #: Config->RSS table column header
'rss-skip' : TT('Skip'), #: Config->RSS table column header
'rss-accept' : TT('Accept'), #: Config->RSS filter-type selection menu
'rss-reject' : TT('Reject'), #: Config->RSS filter-type selection menu
'rss-must' : TT('Requires'), #: Config->RSS filter-type selection menu
'rss-mustcat' : TT('RequiresCat'), #: Config->RSS filter-type selection menu
'rss-delFilter' : TT('X'), #: Config->RSS button "Delete filter"
'rss-matched' : TT('Matched'), #: Config->RSS section header
'rss-notMatched' : TT('Not matched'), #: Config->RSS section header
'rss-done' : TT('Downloaded'), #: Config->RSS section header
'link-download' : TT('Download'), #: Config->RSS button "download item"
'tableFeeds' : TT('Feeds'), #: Tab title for Config->Feeds
'feedSettings' : TT('Settings'), #: Tab title for Config->Feeds

Loading…
Cancel
Save