-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Passing a map with Count to i18n always return the plural value #8454
Comments
bep
added a commit
to bep/hugo
that referenced
this issue
Apr 22, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as `.Count`. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. Fixes gohugoio#8454 Closes gohugoio#7822 See gohugoio/hugoDocs#1410
bep
added a commit
to bep/hugo
that referenced
this issue
Apr 22, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as `.Count`. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. Fixes gohugoio#8454 Closes gohugoio#7822 See gohugoio/hugoDocs#1410
bep
added a commit
to bep/hugo
that referenced
this issue
Apr 22, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as `.Count`. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. Fixes gohugoio#8454 Closes gohugoio#7822 See gohugoio/hugoDocs#1410
Also see gohugoio/hugoDocs#1410 (comment). |
bep
added a commit
to bep/hugo
that referenced
this issue
Apr 22, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as `.Count`. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. Fixes gohugoio#8454 Closes gohugoio#7822 See gohugoio/hugoDocs#1410
bep
added a commit
to bep/hugo
that referenced
this issue
Apr 22, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as `.Count`. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. Fixes gohugoio#8454 Closes gohugoio#7822 See gohugoio/hugoDocs#1410
bep
added a commit
to bep/hugo
that referenced
this issue
Apr 22, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as a int type with a `.Count` method. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. The above means that you can now do pass a single integer and both of the below will work: ``` {{ . }} minutes to read {{ .Count }} minutes to read ``` Fixes gohugoio#8454 Closes gohugoio#7822 See gohugoio/hugoDocs#1410
bep
added a commit
that referenced
this issue
Apr 23, 2021
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as a int type with a `.Count` method. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. The above means that you can now do pass a single integer and both of the below will work: ``` {{ . }} minutes to read {{ .Count }} minutes to read ``` Fixes #8454 Closes #7822 See gohugoio/hugoDocs#1410
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
E.g.
See gohugoio/hugoDocs#1410
/cc @jmooring
The text was updated successfully, but these errors were encountered: