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

In v0.83.0 : i18n|MISSING_TRANSLATION WARN messages for keywords not used in i18n #8492

Closed
divinerites opened this issue May 1, 2021 · 14 comments · Fixed by #8497
Closed

Comments

@divinerites
Copy link

divinerites commented May 1, 2021

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.83.0+extended darwin/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes.

SInce v0.83.0, I now have WARN messages, but for keywords I do not use in i18n.

Most of those keywords seems belonging to my [[menu.main]] section.
But fullscreen is not, and I see nothing obvious for those.

example for 1 site:

i18n|MISSING_TRANSLATION|fr|banner
i18n|MISSING_TRANSLATION|fr|about
i18n|MISSING_TRANSLATION|fr|team
i18n|MISSING_TRANSLATION|fr|contact
i18n|MISSING_TRANSLATION|fr|portfolio
i18n|MISSING_TRANSLATION|fr|rdv
i18n|MISSING_TRANSLATION|fr|moreinfo
i18n|MISSING_TRANSLATION|fr|fullscreen
i18n|MISSING_TRANSLATION|fr|all

and also (closing #8493) this

WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "banner": message "banner" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "banner": message "banner" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "about": message "about" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "about": message "about" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "team": message "team" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "team": message "team" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "contact": message "contact" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "contact": message "contact" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "portfolio": message "portfolio" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "portfolio": message "portfolio" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "banner": message "banner" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "about": message "about" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "team": message "team" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "contact": message "contact" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "portfolio": message "portfolio" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "rdv": message "rdv" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "rdv": message "rdv" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "rdv": message "rdv" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "rdv": message "rdv" has no plural form "one"
WARN 2021/05/01 18:11:04 Failed to get translated string for language "fr" and ID "rdv": message "rdv" has no plural form "one"
@jmooring
Copy link
Member

jmooring commented May 1, 2021

@divinerites,

What do you mean when you say, "I do not use in i18n?"

@divinerites
Copy link
Author

What do you mean when you say, "I do not use in i18n?"

  • They are not in my /i18n/fr.yaml and other language,
  • those are keywords I do not use either in {{ i18n "keyword" }}

@jmooring
Copy link
Member

jmooring commented May 1, 2021

Search your site (including theme) for i18n and T (alias).

@divinerites
Copy link
Author

divinerites commented May 1, 2021

Search your site (including theme) for i18n and T (alias).

Yes. First thing I have done.

And done this on all my sites. They all have the same WARN messages, even if they all have different themes.

Messages seems mainly related to my [[menu.main]] entries and some other WARN where I can't see a pattern.
For example:

[[menu.main]]
name = "banner"
URL = "banner"
weight = 1

[[menu.main]]
name = "about"
URL = "about"
weight = 3

[[menu.main]]
name = "portfolio"
URL = "portfolio"
weight = 10

[[menu.main]]
name = "team"
URL = "team"
weight = 5

[[menu.main]]
name = "contact"
URL = "contact"
weight = 8

@divinerites
Copy link
Author

divinerites commented May 1, 2021

Tried some more testing. This is a false missing translation report (not menu related)

$ hugo --i18n-warnings | grep i18n
i18n|MISSING_TRANSLATION|fr|quick_links
i18n|MISSING_TRANSLATION|fr|contact_info
i18n|MISSING_TRANSLATION|fr|update
i18n|MISSING_TRANSLATION|fr|access
i18n|MISSING_TRANSLATION|fr|fullscreen
i18n|MISSING_TRANSLATION|fr|keep_in_touch
i18n|MISSING_TRANSLATION|fr|adress
i18n|MISSING_TRANSLATION|fr|date_open
i18n|MISSING_TRANSLATION|fr|hours_open

File : /i18n/fr.yml

...

- id: adress
  translation: Adresse
- id: date_open
  translation: Dates d'ouverture
- id: hours_open
  translation: Heures d'ouverture
- id: update
  translation: Mise à jour
- id: access
  translation: Schéma d'accès

@bep
Copy link
Member

bep commented May 2, 2021

OK, I scratched my head a little here as the upstream library actually both returns the correct message, but also an error ... So, it kind of works even with all of these warnings. OK, that's fixable.

@divinerites
Copy link
Author

OK, I scratched my head a little here as the upstream library actually both returns the correct message, but also an error ... So, it kind of works even with all of these warnings. OK, that's fixable.

Oh yes ... I forgot the obvious !!!
I checked and it seems that all my build are correct. So only WARN but nothing wrong (as far i can see) on the builds.

@jmooring
Copy link
Member

jmooring commented May 2, 2021

@divinerites Can you share a repository with me, privately if you wish? I do not understand why are receiving an i18n warning about the keys you don't use. For example, quick_links, fullscreen, etc.

bep added a commit to bep/hugo that referenced this issue May 2, 2021
Fix this by

1. Making sure that only numerical values are treated as plural counts
2. Making sure that `i18n.pluralFormNotFoundError` is not logged as a warning if `other` resolved.

Note that 2. isn't a new problem, but became visible because of the plural improvements in Hugo `0.83.0`.

Fixes gohugoio#8492
@divinerites
Copy link
Author

@divinerites Can you share a repository with me, privately if you wish? I do not understand why are receiving an i18n warning about the keys you don't use. For example, quick_links, fullscreen, etc.

Done. And I can add you to other repository as well if needed. Thanks a lot for the help on this one.

@bep bep closed this as completed in #8497 May 2, 2021
bep added a commit that referenced this issue May 2, 2021
Fix this by

1. Making sure that only numerical values are treated as plural counts
2. Making sure that `i18n.pluralFormNotFoundError` is not logged as a warning if `other` resolved.

Note that 2. isn't a new problem, but became visible because of the plural improvements in Hugo `0.83.0`.

Fixes #8492
@divinerites
Copy link
Author

divinerites commented May 2, 2021

For example, quick_links, fullscreen, etc.

Quick_links is used by {{ i18n = "xxxx" }}, but not fullscreen.

@divinerites
Copy link
Author

Tested you patch, bep and I have no more WARN :-)

jmooring, I double check the fullscreen WARN and it is not used by i18n. I do not have this WARN anymore with bep's patch.

@divinerites
Copy link
Author

divinerites commented May 2, 2021 via email

@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 19, 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.

4 participants
@jmooring @bep @divinerites and others