gh-142927: Tachyon: Comma separate thousands and fix singular/plurals by hugovk · Pull Request #142934 · python/cpython
Conversation
I'd like to suggest using a locale translation for separating numbers instead of using english-based values. I am personally always confused when commas are used to separate thousands and I think it's better if it's using a localized output.
I disagree with the "Single file specialisation," IMO the plural sounds better and in general zero takes a plural noun form?
I'd like to suggest using a locale translation for separating numbers instead of using english-based values. I am personally always confused when commas are used to separate thousands and I think it's better if it's using a localized output.
Right now, the numbers are formatted in the Python script, and then put into the HTML. I guess one way would be to put unformatted numbers in the HTML and use some JS to do locale conversion in the browser?
I disagree with the "Single file specialisation," IMO the plural sounds better and in general zero takes a plural noun form?
"x/y" is like saying "x of y", and it's the "y" that matters for the plural:
- "0 of 0 instructions"
- "0 of 1 instruction"
- "1 of 1 instruction"
- "1 of 4 instructions"
- "3 of 4 instructions"
Right now, the numbers are formatted in the Python script, and then put into the HTML. I guess one way would be to put unformatted numbers in the HTML and use some JS to do locale conversion in the browser?
Can't we use localized messages? or maybe pass through locale.(...) for formatting numbers?
Yes, and that's much simpler :)
How does this 9cfd9ef look?
It looks better (and simpler). For the "words" we can also use gettext.ngettext to get a possible localized plural form (I don't know if you want all messages to be localized actually, but I think it may makes sense. argparse has localized output and profiling is something that is also very user-facing)
hugovk
deleted the
3.15-tachyon-formatting
branch