diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Print the language shares without the locale
Diffstat (limited to 'source/ui-stats.c')
-rw-r--r--source/ui-stats.c6
1 file changed, 5 insertions, 1 deletion
diff --git a/source/ui-stats.c b/source/ui-stats.c
index 58bd818..89bb05f 100644
--- a/source/ui-stats.c
+++ b/source/ui-stats.c
@@ -476,13 +476,17 @@ static void print_language_row(const char *label, unsigned long bytes,
unsigned long total)
{
struct strbuf size = STRBUF_INIT;
+ int tenths;
strbuf_humanise_bytes(&size, bytes);
html("<tr><td class='left'>");
html_txt(label);
html("</td><td>");
html_txt(size.buf);
- htmlf("</td><td>%.1f%%</td></tr>\n", 100.0 * bytes / total);
+ // Printed from integers so a Lua filter switching LC_NUMERIC to a
+ // comma-decimal locale cannot change the output.
+ tenths = (int)(1000.0 * bytes / total + 0.5);
+ htmlf("</td><td>%d.%d%%</td></tr>\n", tenths / 10, tenths % 10);
strbuf_release(&size);
}