SizeToStr doesn't support localisation

Bug #435133 reported by Luca Ferretti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Low
Unassigned

Bug Description

apt-pkg/contrib/strutl.cc

The format string isn't translatable.

Original bug report:

Binary package hint: aptdaemon

Currently, aptdaemon shows the following messages while downloading stuff:
    Downloaded %sB of %sB at %sB/s
    Downloaded %sB of %sB

In this way, it only shows sizes as byte. Could be good, instead, select the best mutiplier based on actual size.

ProblemType: Bug
Architecture: i386
Date: Wed Sep 23 11:13:27 2009
DistroRelease: Ubuntu 9.10
Package: aptdaemon 0.10+bzr240-0ubuntu1
PackageArchitecture: all
ProcEnviron:
 LANG=it_IT.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-10.34-generic
SourcePackage: aptdaemon
Uname: Linux 2.6.31-10-generic i686

Revision history for this message
Luca Ferretti (elle.uca) wrote :
Revision history for this message
Sebastian Heinlein (glatzor) wrote :

The used SizeToStr function should report 1024 as 1K.

            self.set_text(_("Downloaded %sB of %sB "
                            "at %sB/s") % (apt_pkg.SizeToStr(bytes_done),
                                          apt_pkg.SizeToStr(bytes_total),
                                          apt_pkg.SizeToStr(speed)))d)))

Doesn't this work?

Changed in aptdaemon (Ubuntu):
status: New → Incomplete
Revision history for this message
Luca Ferretti (elle.uca) wrote :

Oh, I see.
Then the issue is about localization: something like "345KB" is wrong, for example, in Italian language: here a space is needed between the number and the measure unit, like "345 KB".

So IMHO ideally there should be following transable messages:
  * "Downloaded %(current)s of %(total)s at %(ratio)s" (and the other one without ratio)
  * "%d B"
  * "%d kB"
  * "%d MB"

See for example http://paste.ubuntu.com/276837/

Michael Vogt (mvo)
Changed in aptdaemon (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → Low
summary: - Show downloading sizes using byte multiples
+ SizeToStr doesn't support localisation
affects: aptdaemon (Ubuntu) → apt (Ubuntu)
description: updated
Revision history for this message
Victor Vargas (kamus) wrote :

@Luca, please could you check if this behaviour is still occurring in latest release included in Ubuntu Lucid? Anyway, I have downloaded source code and I can't find that line (maybe has lot of changes) but I found the function and now works in this way:

// SizeToStr - Convert a long into a human readable size /*{{{*/
// ---------------------------------------------------------------------
/* A max of 4 digits are shown before conversion to the next highest unit.
   The max length of the string will be 5 chars unless the size is > 10
   YottaBytes (E24) */
string SizeToStr(double Size)
{
   char S[300];
   double ASize;
   if (Size >= 0)
      ASize = Size;
   else
      ASize = -1*Size;

   /* bytes, KiloBytes, MegaBytes, GigaBytes, TeraBytes, PetaBytes,
      ExaBytes, ZettaBytes, YottaBytes */
   char Ext[] = {'\0','k','M','G','T','P','E','Z','Y'};
   int I = 0;
   while (I <= 8)
   {
      if (ASize < 100 && I != 0)
      {
         sprintf(S,"%'.1f%c",ASize,Ext[I]);
         break;
      }

      if (ASize < 10000)
      {
         sprintf(S,"%'.0f%c",ASize,Ext[I]);
         break;
      }
      ASize /= 1000.0;
      I++;
   }

   return S;
}

Changed in apt (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Vish (vish) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future.
To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New".

Changed in apt (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.