-
-
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
Hugo 0.76.* i18n .Count warning message #7822
Comments
I change |
The problem is that it works as before in Hugo v0.76.* only. Any other versions like
I can't speak for everyone, but I use this expression to pass variable in the translation string. |
This is per documentation |
Seeing the same thing with 0.76.3 and the Beautiful Hugo theme, destroys the posted on date in the generated site.
|
A note after some experimentation on my own site: I think it's hard to find the best way to go here. For ease of use, keeping things compatible is great, but that's a complicated way to go since developers would have to do the same for all libs Hugo depend upon (which would end being an impossible task and might kill Hugo's performances in the end). As far as I'm concerned, and Hugo's developers will of course have the final word, this should be divided into two tasks:
A workaround for people who use not-updated themes would be to write translation files and overwrite the problematic translations in your local files. It's a quickfix, but if I'm correct on Hugo's order of precedence, it will take the translation you provide over the one included inside the theme. You would just need to write the failing translations, no more. One open question: I don't know who adds the "Count" variable? Is it Hugo when wrapping an int it passes to go-i18n, or is it go-i18n itself? In the first case, wouldn't it be possible to send it as |
testing it with v0.76.4ext as the op's, if there's a variable named Anyhow. if I were to have as the op's
on the config file, and I'd name |
gohugoio/hugo#7822 happens on build - fix is to overide the theme in translation the theme itself has already done halogenica/beautifulhugo@28a65d8#diff-d57e09739aebffaedf6e8a1d875a3ffcdc4f168361b3c292f7f7b1665372e4c0
Related: gohugoio/hugoDocs#1410 |
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
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
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
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
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
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
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. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes.
It works correctly in 0.48.0 – 0.75.1 without any warnings.
Problem
Mainroad demo build log shows the following warning messages since bumping to Hugo 0.76.*:
As a result, i18n string (
authorbox_name
) does not work as before.Screenshot
Example
You can see it in action (authorbox block at the bottom of the page):
Demo 0.48.0
Hugo Themes demo (0.76.4)
Steps to reproduce
Clone Mainroad repository and cd in the exampleSite dir
git clone https://github.com/vimux/mainroad.git cd mainroad/exampleSite/
Run Hugo server with the following command:
Visit http://localhost:1313/post/hugoisforlovers/ in your browser and scroll to the bottom of the page.
Related parts:
i18n/en.yaml
partials/authorbox.html
The text was updated successfully, but these errors were encountered: