return [date, time, period].join(' ');
},
- plural: function(i, word)
+ ngettext: function(msgid, msgid_plural, n)
{
- return [ i.toStringWithCommas(), ' ', word, (i==1?'':'s') ].join('');
+ // TODO(i18n): http://doc.qt.digia.com/4.6/i18n-plural-rules.html
+ return n === 1 ? msgid : msgid_plural;
+ },
+
+ countString: function(msgid, msgid_plural, n)
+ {
+ return [ n.toStringWithCommas(), ngettext(msgid,msgid_plural,n) ].join(' ');
},
peerStatus: function( flagStr )
if (tracker.hasAnnounced) {
lastAnnounceTime = Transmission.fmt.timestamp(tracker.lastAnnounceTime);
if (tracker.lastAnnounceSucceeded) {
- lastAnnounce = [ lastAnnounceTime, ' (got ', Transmission.fmt.plural(tracker.lastAnnouncePeerCount, 'peer'), ')' ];
+ lastAnnounce = [ lastAnnounceTime, ' (got ', Transmission.fmt.countString('peer','peers',tracker.lastAnnouncePeerCount), ')' ];
} else {
lastAnnounceLabel = 'Announce error';
lastAnnounce = [ (tracker.lastAnnounceResult ? (tracker.lastAnnounceResult + ' - ') : ''), lastAnnounceTime ];
return [ 'Downloading from',
t.getPeersSendingToUs(),
'of',
- fmt.plural (peer_count, 'peer'),
+ fmt.countString('peer','peers',peer_count),
'and',
- fmt.plural (webseed_count, 'web seed') ].join(' ');
+ fmt.countString('web seed','web seeds',webseed_count) ].join(' ');
}
else if (webseed_count)
{
// Downloading from 2 webseed(s)
return [ 'Downloading from',
- fmt.plural (webseed_count, 'web seed') ].join(' ');
+ fmt.countString('web seed','web seeds',webseed_count) ].join(' ');
}
else
{
return [ 'Downloading from',
t.getPeersSendingToUs(),
'of',
- fmt.plural (peer_count, 'peer') ].join(' ');
+ fmt.countString('peer','peers',peer_count) ].join(' ');
}
}
return [ 'Seeding to',
t.getPeersGettingFromUs(),
'of',
- fmt.plural (t.getPeersConnected(), 'peer'),
+ fmt.countString ('peer','peers',t.getPeersConnected()),
'-',
TorrentRendererHelper.formatUL(t) ].join(' ');
$('#speed-dn-label').text( fmt.speedBps( d ) );
// visible torrents
- $('#filter-count').text( fmt.plural(this._rows.length, 'Transfer') );
+ $('#filter-count').text( fmt.countString('Transfer','Transfers',this._rows.length ) );
},
setEnabled: function(key, flag)