Author: lslezak Date: Tue Mar 11 13:13:53 2008 New Revision: 45340 URL: http://svn.opensuse.org/viewcvs/yast?rev=45340&view=rev Log: - improved String::FormatRateMessage() (needed for #168935) - 2.16.34 Modified: trunk/yast2/VERSION trunk/yast2/library/types/src/String.ycp trunk/yast2/package/yast2.changes Modified: trunk/yast2/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/VERSION?rev=45340&r1=45339&r2=45340&view=diff ============================================================================== --- trunk/yast2/VERSION (original) +++ trunk/yast2/VERSION Tue Mar 11 13:13:53 2008 @@ -1 +1 @@ -2.16.33 +2.16.34 Modified: trunk/yast2/library/types/src/String.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/types/src/String.ycp?rev=45340&r1=45339&r2=45340&view=diff ============================================================================== --- trunk/yast2/library/types/src/String.ycp (original) +++ trunk/yast2/library/types/src/String.ycp Tue Mar 11 13:13:53 2008 @@ -162,7 +162,7 @@ * * Add the current and the average download rate to the message. * - * @param text the message + * @param text the message with %1 placeholder for the download rate string * @param avg_bps average download rate (in B/s) * @param curr_bps current download rate (in B/s) * @@ -170,12 +170,26 @@ */ global string FormatRateMessage(string text, integer avg_bps, integer curr_bps) { - // format download rate message - // %1 - input message (e.g. "Downloading Package") - // %2 - current download rate in B/s, KB/s... - // %3 - average download rate since start - // example - "Downloading Package - 237.34 KB/s (avg. 243.21 KB/s)" - return sformat(_("%1 - %2 (avg. %3)"), text, FormatRate(curr_bps), FormatRate(avg_bps)); + string rate = ""; + + if (curr_bps > 0) + { + rate = FormatRate(curr_bps); + + if (avg_bps > 0) + { + // format download rate message: %1 = the current download rate (e.g. "242.6kB/s") + // %2 is the average download rate (e.g. "228.3kB/s") + // to translators: keep translation of "on average" as short as possible + rate = sformat(_("%1 (on average %2)"), rate, String::FormatRate(avg_bps)); + } + } + + // add download rate to the downloading message + // %1 is URL, %2 is formatted download rate, e.g. "242.6kB/s (avg. 228.3kB/s)" + // in ncurses UI the strings are exchanged (%1 is the rate, %2 is URL) + // due to limited space on the screen + return sformat(text, rate); } /** Modified: trunk/yast2/package/yast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=45340&r1=45339&r2=45340&view=diff ============================================================================== --- trunk/yast2/package/yast2.changes (original) +++ trunk/yast2/package/yast2.changes Tue Mar 11 13:13:53 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Mar 11 13:00:07 CET 2008 - lslezak@suse.cz + +- improved String::FormatRateMessage() (needed for #168935) +- 2.16.34 + +------------------------------------------------------------------- Wed Mar 5 17:37:15 CET 2008 - lslezak@suse.cz - register Refresh callbacks (required for FATE #30962, bnc #231745) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org