Ticket #4121: years.diff

File years.diff, 3.4 KB (added by Waldorf, 11 years ago)
  • macosx/StatsWindowController.m

     
    189189        : NSLocalizedString(@"Total N/A", "stats total");
    190190    [fRatioAllField setStringValue: totalRatioString];
    191191   
    192     [fTimeField setStringValue: [NSString timeString: statsSession.secondsActive showSeconds: NO]];
     192    [fTimeField setStringValue: [NSString timeString: statsSession.secondsActive showSeconds: YES maxFields: 3]];
    193193    [fTimeAllField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ total", "stats total"),
    194                                         [NSString timeString: statsAll.secondsActive showSeconds: NO]]];
     194                                        [NSString timeString: statsAll.secondsActive showSeconds: NO maxFields: 3]]];
    195195   
    196196    if (statsAll.sessionCount == 1)
    197197        [fNumOpenedField setStringValue: NSLocalizedString(@"1 time", "stats window -> times opened")];
  • macosx/en.lproj/Localizable.strings

     
    9595"%llu times" = "%llu times";
    9696
    9797/* time string */
     98"1 year" = "1 year";
     99
     100/* time string */
     101"%u years" = "%u years";
     102
     103/* time string */
     104"1 day" = "1 day";
     105
     106/* time string */
    98107"%u days" = "%u days";
    99108
    100109/* time string */
     
    106115/* time string */
    107116"%u sec" = "%u sec";
    108117
    109 /* time string */
    110 "1 day" = "1 day";
    111 
    112118/* Add torrent -> info
    113119   Create torrent -> info
    114120   Drag overlay -> torrents
  • macosx/NSStringAdditions.m

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    122122{
    123123    NSAssert(max > 0, @"Cannot generate a time string with no fields");
    124124   
    125     NSMutableArray * timeArray = [NSMutableArray arrayWithCapacity: MIN(max, 4)];
     125    NSMutableArray * timeArray = [NSMutableArray arrayWithCapacity: MIN(max, 5)];
    126126    NSUInteger remaining = seconds; //causes problems for some users when it's a uint64_t
    127127   
    128     if (seconds >= (24 * 60 * 60))
     128    if (seconds >= 31557600) //official amount of seconds in one year
    129129    {
     130        const NSUInteger years = remaining / 31557600;
     131        if (years == 1)
     132            [timeArray addObject: NSLocalizedString(@"1 year", "time string")];
     133        else
     134            [timeArray addObject: [NSString stringWithFormat: NSLocalizedString(@"%u years", "time string"), years]];
     135        remaining %= 31557600;
     136        max--;
     137    }
     138    if (max > 0 && seconds >= (24 * 60 * 60))
     139    {
    130140        const NSUInteger days = remaining / (24 * 60 * 60);
    131141        if (days == 1)
    132142            [timeArray addObject: NSLocalizedString(@"1 day", "time string")];