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

Enhance i18n function to handle floats #8464

Closed
jmooring opened this issue Apr 23, 2021 · 1 comment · Fixed by #8465
Closed

Enhance i18n function to handle floats #8464

jmooring opened this issue Apr 23, 2021 · 1 comment · Fixed by #8465

Comments

@jmooring
Copy link
Member

i18n/en.toml

[hour]
one = "{{ . }} hour"
other = "{{ . }} hours"

Test results with e4dc9a8:

ID Statement Actual Expected Status
1 T "hour" 1 1 hour 1 hour Pass
2 T "hour" 1.5 1.5 hour 1.5 hours Fail
3 T "hour" 2 2 hours 2 hours Pass
4 T "hour" "1" 1 hour 1 hour Pass
5 T "hour" "1.5" 1.5 hours 1.5 hours Pass
6 T "hour" "2" 2 hours 2 hours Pass

The existing float test passes because, in English, 22.5 and 22 both belong to the other cardinal category as defined by the CLDR plural rules.

I am unsure why test 5 passes while test 2 fails.

In Polish 100 and 100.0 should be handled differently.

i18n/pl.toml

[day]
one = "{{ . }} miesiąc"
few = "{{ . }} miesiące"
many = "{{ . }} miesięcy"
other = "{{ . }} miesiąca"

Test results with e4dc9a8:

ID Statement Actual Expected Status
7 T "day" 1 1 miesiąc 1 miesiąc Pass
8 T "day" 2 2 miesiące 2 miesiące Pass
9 T "day" 100 100 miesięcy 100 miesięcy Pass
10 T "day" 100.0 100 miesięcy 100.0 miesiąca Fail
@bep bep added Enhancement and removed Proposal labels Apr 24, 2021
@bep bep changed the title Enhance i18n function to handle floats Enhance i18n function to round floats Apr 24, 2021
@bep bep added this to the v0.83 milestone Apr 24, 2021
@bep bep changed the title Enhance i18n function to round floats Enhance i18n function to handle floats Apr 24, 2021
bep added a commit to bep/hugo that referenced this issue Apr 24, 2021
The go-i18n library expects plural counts with floats to be represented as strings.

Fixes gohugoio#8464
bep added a commit to bep/hugo that referenced this issue Apr 24, 2021
The go-i18n library expects plural counts with floats to be represented as strings.

Fixes gohugoio#8464
bep added a commit to bep/hugo that referenced this issue Apr 24, 2021
The go-i18n library expects plural counts with floats to be represented as strings.

Fixes gohugoio#8464
bep added a commit to bep/hugo that referenced this issue Apr 24, 2021
The go-i18n library expects plural counts with floats to be represented as strings.

Fixes gohugoio#8464
@bep bep closed this as completed in #8465 Apr 25, 2021
bep added a commit that referenced this issue Apr 25, 2021
The go-i18n library expects plural counts with floats to be represented as strings.

Fixes #8464
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants