[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#223712: [apt-get] Permit i18n support in SizeToStr()



Hi,

Pierre Machard, le Thu 11 Dec 2003 20:45:15 +0100, a écrit :
> --- current/apt-0.5.14/apt-pkg/contrib/strutl.cc	2003-07-18 16:15:11.000000000 +0200
> +++ apt-0.5.14/apt-pkg/contrib/strutl.cc	2003-12-11 19:50:38.000000000 +0100
> @@ -270,7 +270,7 @@
>        
>        if (ASize < 10000)
>        {
> -         sprintf(S,"%.0f%c",ASize,Ext[I]);
> +         sprintf(S,_("%.0f%c"),ASize,Ext[I]);
>  	 break;
>        }
>        ASize /= 1000.0;

Here is an updated and corrected patch: it makes use of the ' flag, that
enables thousand (or other unity) separator according to the current
locale.

I'm not sure, but maybe the Ext array itself should get translated too?

Regards,
Samuel

--- apt-pkg/contrib/strutl.cc.orig	2006-02-15 10:58:33.000000000 +0100
+++ apt-pkg/contrib/strutl.cc	2006-02-15 11:00:30.000000000 +0100
@@ -307,13 +307,13 @@ string SizeToStr(double Size)
    {
       if (ASize < 100 && I != 0)
       {
-         sprintf(S,"%.1f%c",ASize,Ext[I]);
+         sprintf(S,_("%'.1f%c"),ASize,Ext[I]);
 	 break;
       }
       
       if (ASize < 10000)
       {
-         sprintf(S,"%.0f%c",ASize,Ext[I]);
+         sprintf(S,_("%'.0f%c"),ASize,Ext[I]);
 	 break;
       }
       ASize /= 1000.0;



Reply to: