mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
#764 Use locale specific floats
This commit is contained in:
parent
2eb900f876
commit
ced900ea12
7 changed files with 27 additions and 28 deletions
|
@ -2157,7 +2157,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
int i;
|
||||
for (i = 0; ratioLimitActionValue[i] != -1; i++)
|
||||
{
|
||||
item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%.2f", ratioLimitActionValue[i]]
|
||||
item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
|
||||
action: @selector(setQuickRatioGlobal:) keyEquivalent: @""];
|
||||
[item setTarget: self];
|
||||
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
|
||||
|
@ -3415,7 +3415,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
{
|
||||
BOOL check = menuItem == fCheckRatioItem;
|
||||
if (check)
|
||||
[menuItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
|
||||
[menuItem setTitle: [NSString localizedStringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
|
||||
"Action menu -> ratio stop"), [fDefaults floatForKey: @"RatioLimit"]]];
|
||||
|
||||
[menuItem setState: [fDefaults boolForKey: @"RatioCheck"] ? check : !check];
|
||||
|
@ -3720,8 +3720,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
if (seeding > 0)
|
||||
{
|
||||
NSString * title = [NSString stringWithFormat: NSLocalizedString(@"%d Seeding",
|
||||
"Dock item - Seeding"), seeding];
|
||||
NSString * title = [NSString stringWithFormat: NSLocalizedString(@"%d Seeding", "Dock item - Seeding"), seeding];
|
||||
if (!seedingItem)
|
||||
{
|
||||
seedingItem = [[[NSMenuItem alloc] initWithTitle: title action: nil keyEquivalent: @""] autorelease];
|
||||
|
@ -3739,8 +3738,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
if (downloading > 0)
|
||||
{
|
||||
NSString * title = [NSString stringWithFormat: NSLocalizedString(@"%d Downloading",
|
||||
"Dock item - Downloading"), downloading];
|
||||
NSString * title = [NSString stringWithFormat: NSLocalizedString(@"%d Downloading", "Dock item - Downloading"), downloading];
|
||||
if (!downloadingItem)
|
||||
{
|
||||
downloadingItem = [[[NSMenuItem alloc] initWithTitle: title action: nil keyEquivalent: @""] autorelease];
|
||||
|
|
|
@ -216,7 +216,7 @@
|
|||
Torrent * torrent = [(FileOutlineView *)[self controlView] torrent];
|
||||
float percent = [torrent fileProgress: [[[self objectValue] objectForKey: @"Indexes"] firstIndex]] * 100.0;
|
||||
|
||||
NSString * status = [NSString stringWithFormat: NSLocalizedString(@"%.2f%% of %@",
|
||||
NSString * status = [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% of %@",
|
||||
"Inspector -> Files tab -> file status string"), percent,
|
||||
[NSString stringForFileSize: [[[self objectValue] objectForKey: @"Size"] unsignedLongLongValue]]];
|
||||
|
||||
|
|
|
@ -817,7 +817,7 @@ typedef enum
|
|||
NSDictionary * peer = [fPeers objectAtIndex: row];
|
||||
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
|
||||
|
||||
[components addObject: [NSString stringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
|
||||
[components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
|
||||
"Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
|
||||
|
||||
if ([[peer objectForKey: @"Encryption"] boolValue])
|
||||
|
@ -1094,7 +1094,7 @@ typedef enum
|
|||
torrent = [fTorrents objectAtIndex: 0];
|
||||
|
||||
[fStateField setStringValue: [torrent stateString]];
|
||||
[fProgressField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",
|
||||
[fProgressField setStringValue: [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",
|
||||
"Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]];
|
||||
[fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
|
||||
[fSwarmSpeedField setStringValue: [torrent isActive] ? [NSString stringForSpeed: [torrent swarmSpeed]] : @""];
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
}
|
||||
|
||||
//attempt to have minimum of 3 digits with at least 1 decimal
|
||||
return [NSString stringWithFormat: convertedSize < 10.0 ? @"%.2f %@" : @"%.1f %@", convertedSize, unit];
|
||||
return [NSString localizedStringWithFormat: convertedSize < 10.0 ? @"%.2f %@" : @"%.1f %@", convertedSize, unit];
|
||||
}
|
||||
|
||||
+ (NSString *) stringForSpeed: (float) speed
|
||||
|
@ -77,13 +77,13 @@
|
|||
+ (NSString *) stringForSpeedAbbrev: (float) speed
|
||||
{
|
||||
if (speed < 1000.0) //0.0 K to 999.9 K
|
||||
return [NSString stringWithFormat: @"%.1f K", speed];
|
||||
return [NSString localizedStringWithFormat: @"%.1f K", speed];
|
||||
else if (speed < 102400.0) //0.98 M to 99.99 M
|
||||
return [NSString stringWithFormat: @"%.2f M", speed / 1024.0];
|
||||
return [NSString localizedStringWithFormat: @"%.2f M", speed / 1024.0];
|
||||
else if (speed < 1024000.0) //100.0 M to 999.9 M
|
||||
return [NSString stringWithFormat: @"%.1f M", speed / 1024.0];
|
||||
return [NSString localizedStringWithFormat: @"%.1f M", speed / 1024.0];
|
||||
else //insane speeds
|
||||
return [NSString stringWithFormat: @"%.2f G", speed / 1048576.0];
|
||||
return [NSString localizedStringWithFormat: @"%.2f G", speed / 1048576.0];
|
||||
}
|
||||
|
||||
+ (NSString *) stringForRatio: (float) ratio
|
||||
|
@ -95,11 +95,11 @@
|
|||
else;
|
||||
|
||||
if (ratio < 10.0)
|
||||
return [NSString stringWithFormat: @"%.2f", ratio];
|
||||
return [NSString localizedStringWithFormat: @"%.2f", ratio];
|
||||
else if (ratio < 100.0)
|
||||
return [NSString stringWithFormat: @"%.1f", ratio];
|
||||
return [NSString localizedStringWithFormat: @"%.1f", ratio];
|
||||
else
|
||||
return [NSString stringWithFormat: @"%.0f", ratio];
|
||||
return [NSString localizedStringWithFormat: @"%.0f", ratio];
|
||||
}
|
||||
|
||||
+ (NSString *) timeString: (uint64_t) seconds showSeconds: (BOOL) showSeconds
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
{
|
||||
if (!fAttributes)
|
||||
fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont systemFontOfSize: 11.0], NSFontAttributeName, nil];
|
||||
[[NSString stringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame withAttributes: fAttributes];
|
||||
[[NSString localizedStringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame
|
||||
withAttributes: fAttributes];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -972,12 +972,12 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
{
|
||||
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
|
||||
{
|
||||
string = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)", "Torrent -> progress string"),
|
||||
[NSString stringForFileSize: [self haveTotal]], [NSString stringForFileSize: [self totalSizeSelected]],
|
||||
100.0 * [self progressDone]];
|
||||
string = [NSString localizedStringWithFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)",
|
||||
"Torrent -> progress string"), [NSString stringForFileSize: [self haveTotal]],
|
||||
[NSString stringForFileSize: [self totalSizeSelected]], 100.0 * [self progressDone]];
|
||||
}
|
||||
else
|
||||
string = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
|
||||
string = [NSString localizedStringWithFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
|
||||
[NSString stringForFileSize: [self haveTotal]],
|
||||
[NSString stringForFileSize: [self size]], 100.0 * [self progress]];
|
||||
}
|
||||
|
@ -1044,7 +1044,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
break;
|
||||
|
||||
case TR_STATUS_CHECK:
|
||||
string = [NSString stringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
|
||||
string = [NSString localizedStringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
|
||||
"Torrent -> status string"), 100.0 * [self checkingProgress]];
|
||||
break;
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
break;
|
||||
|
||||
case TR_STATUS_CHECK:
|
||||
string = [NSString stringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
|
||||
string = [NSString localizedStringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
|
||||
"Torrent -> status string"), 100.0 * [self checkingProgress]];
|
||||
break;
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
return NSLocalizedString(@"Paused", "Torrent -> status string");
|
||||
|
||||
case TR_STATUS_CHECK:
|
||||
return [NSString stringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
|
||||
return [NSString localizedStringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
|
||||
"Torrent -> status string"), 100.0 * [self checkingProgress]];
|
||||
|
||||
case TR_STATUS_CHECK_WAIT:
|
||||
|
|
|
@ -622,7 +622,7 @@
|
|||
int i;
|
||||
for (i = 0; ratioLimitActionValue[i] != -1.0; i++)
|
||||
{
|
||||
item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%.2f", ratioLimitActionValue[i]]
|
||||
item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
|
||||
action: @selector(setQuickRatio:) keyEquivalent: @""];
|
||||
[item setTarget: self];
|
||||
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
|
||||
|
@ -635,8 +635,8 @@
|
|||
|
||||
item = [menu itemWithTag: ACTION_MENU_LIMIT_TAG];
|
||||
[item setState: mode == NSOnState ? NSOnState : NSOffState];
|
||||
[item setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)", "torrent action menu -> ratio stop"),
|
||||
[fMenuTorrent ratioLimit]]];
|
||||
[item setTitle: [NSString localizedStringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
|
||||
"torrent action menu -> ratio stop"), [fMenuTorrent ratioLimit]]];
|
||||
|
||||
item = [menu itemWithTag: ACTION_MENU_UNLIMITED_TAG];
|
||||
[item setState: mode == NSOffState ? NSOnState : NSOffState];
|
||||
|
|
Loading…
Reference in a new issue