Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“1 hours today” #3102

Closed
dae opened this issue Mar 29, 2024 · 1 comment · Fixed by #3162
Closed

“1 hours today” #3102

dae opened this issue Mar 29, 2024 · 1 comment · Fixed by #3162

Comments

@dae
Copy link
Member

dae commented Mar 29, 2024

I’ve noticed that if you study for exactly one hour, you’re told “Studied n cards in 1 hours today (_m_s/card).”
This is an incredibly minor point, but ideally it would say “1 hour” instead of “1 hours” (but be plural again for “1.1 hours”, “1.2 hours”, etc.).

Originally reported on https://forums.ankiweb.net/t/1-hours-today/42956

It's caused by non-integer numbers that are rounded to an integer in format_number_values(), eg 1.0005 becomes 1.00 which ends up being to 1. I'm not sure we can easily fix this, as I think the plural choice is happening in fluent's code, not ours. Converting the fluent numbers to integers if they round to an integer might work?

@hnvy
Copy link
Contributor

hnvy commented Apr 17, 2024

Hi!

I realise this is a very trivial thing, but would it not be possible to display all of the numbers in decimal format (including 1, 2, 3, etc.)?

Numbers expressed in the decimal format use the noun's plural form.

Showing "1.00" will not only guarantee formatting consistency between the whole hours and the partials, but it will also address the plural problem that is mentioned above. Two birds, one stone.

So, force decimals on all numbers:

  • 1 -> 1.00
  • 2 -> 2.00
  • 3 -> 3.00
  • ...

I guess it would be a lot easier to code than the alternative?

It's explained much better on here:
https://doc.rust-lang.org/std/fmt/#precision

I hope that makes sense.

Harvey R.

Edit:
Ah, I see that there is this let mut val: Cow<str> = with_max_precision.trim_end_matches('0').into();. Then, in that case, you can ignore my suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants