Fix localization in Web+ download window.

Fixes #16391
This commit is contained in:
Adrien Destugues
2020-07-12 12:06:22 +02:00
parent b0a3a5c9bc
commit c97647019c
+8 -11
View File
@@ -747,7 +747,6 @@ DownloadProgressView::_UpdateStatusText()
if (sShowSpeed && fBytesPerSecond != 0.0) { if (sShowSpeed && fBytesPerSecond != 0.0) {
// Draw speed info // Draw speed info
char sizeBuffer[128]; char sizeBuffer[128];
buffer = "(";
// Get strings for current and expected size and remove the unit // Get strings for current and expected size and remove the unit
// from the current size string if it's the same as the expected // from the current size string if it's the same as the expected
// size unit. // size unit.
@@ -762,21 +761,19 @@ DownloadProgressView::_UpdateStatusText()
expectedSize.String() + expectedSizeUnitPos) == 0) { expectedSize.String() + expectedSizeUnitPos) == 0) {
currentSize.Truncate(currentSizeUnitPos); currentSize.Truncate(currentSizeUnitPos);
} }
buffer << currentSize;
buffer << " "; buffer = B_TRANSLATE("(%currentSize% of %expectedSize%, %rate%/s)");
buffer << B_TRANSLATE_COMMENT("of", "...as in '12kB of 256kB'"); buffer.ReplaceFirst("%currentSize%", currentSize);
buffer << " "; buffer.ReplaceFirst("%expectedSize%", expectedSize);
buffer << expectedSize; buffer.ReplaceFirst("%rate%", string_for_size(fBytesPerSecond,
buffer << ", "; sizeBuffer, sizeof(sizeBuffer)));
buffer << string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer));
buffer << B_TRANSLATE_COMMENT("/s)", "...as in 'per second'");
float stringWidth = fInfoView->StringWidth(buffer.String()); float stringWidth = fInfoView->StringWidth(buffer.String());
if (stringWidth < fInfoView->Bounds().Width()) if (stringWidth < fInfoView->Bounds().Width())
fInfoView->SetText(buffer.String()); fInfoView->SetText(buffer.String());
else { else {
// complete string too wide, try with shorter version // complete string too wide, try with shorter version
buffer << string_for_size(fBytesPerSecond, sizeBuffer, buffer = string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer)); sizeof(sizeBuffer));
buffer << B_TRANSLATE_COMMENT("/s)", "...as in 'per second'"); buffer << B_TRANSLATE_COMMENT("/s)", "...as in 'per second'");
stringWidth = fInfoView->StringWidth(buffer.String()); stringWidth = fInfoView->StringWidth(buffer.String());