Conversation
|
Hi, I mentioned this already in your other PR:
return _("%0.1f Gbps") % (val / 1000)sample output: In [11]: print("%0.1f Gbps" % (1024 / 1000))
1.0 Gbps
In [12]: print("%0.1f Gbps" % (1204 / 1000))
1.2 Gbps
In [13]: print("%s Gbps" % ("%d" % (1024 / 1000)))
1 Gbps
In [14]: print("%s Gbps" % ("%d" % (1500 / 1000)))
1 Gbps
In [15]: print("%0.1f Gbps" % (1500 / 1000))
1.5 Gbps |
b30db6e to
e2a5a4b
Compare
|
Hi, I have cleaned up the PR. I'm a bit lost about the Mbps string. The original string uses the %d formatter, which prevents the "1.5 Mbps" speed from being displayed correctly. I don't see a way to fix it without changing the formatter. Am I missing an obvious way ? |
|
Hi, This isn't a critical bug, we can push it to master without having to backport it to 22.3. So with that in mind, don't worry about changing the translation strings. |
|
Hi, In that case, I think this is ready to be merged. Thank you. |
usr/lib/linuxmint/mintreport/usb.py
Outdated
|
|
||
| if val >= 10000: | ||
| return _("%d Gbps") % val | ||
| return _("%s Gbps") % ("%d" % (val / 1000)) |
There was a problem hiding this comment.
This is still overly complex. Don't use %d to perform a type conversion for you, just do the type conversion and use '%d' in the string.
return _("%d Gbps") % int(val / 1000)
There was a problem hiding this comment.
My intention was to achieve consistency between Gpbs and Mbps translation string, by having "%s" in both.
I understand it makes the code more complicated than necessary.
Will fix.
There was a problem hiding this comment.
This doesn't matter to translators. You're using the wrong tool to force an integer.
e2a5a4b to
a1ede3f
Compare


Fix the display of the USB speed :
To fix it, I replaced all the %d strings by %s, so that we can directly print strings.
When the speed is high enough, we still convert it to Gpbs
When it isnt, directly print the value obtained, it is already in Mbps and requires no conversion.
Closes #111
(It builds upon my previous MR #113)
I still need to test on another PC with 20 gpbs USB, hence marking as "draft" for one day.