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

Improve i18n warnings #9097

Open
jmooring opened this issue Oct 29, 2021 · 1 comment
Open

Improve i18n warnings #9097

jmooring opened this issue Oct 29, 2021 · 1 comment

Comments

@jmooring
Copy link
Member

jmooring commented Oct 29, 2021

Details

Pluralization warnings were eliminated during the implementation of #8497.

i18n/pl.toml

[day]
other = "miesiąca"
Statement Result Current Warning Desired Warning
{{ i18n "day" }} miesiąca
{{ i18n "day" 0 }} miesiąca WARN ... "day" has no plural form "many"
{{ i18n "day" 1 }} miesiąca WARN ... "day" has no plural form "one"
{{ i18n "day" 2 }} miesiąca WARN ... "day" has no plural form "few"
{{ i18n "day" "1.5" }} miesiąca

Ref: https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_plural_rules.html

Background

The motivation behind #8497 was to suppress warnings when site authors translate words or phrases that do not require pluralization, using this construct:

i18n/es.toml

[contact]
other = "contacto"

and then invoke the translation without specifying a quantity: {{ i18n "contact" }}

Ideally, all i18n files should have this structure:

# Items without pluralization rules.

contact = "contacto"
help = "ayuda"

# Items with pluralization rules.

[day]
one = "día"
other = "días"

Approach

Detect when the i18n function has been passed a quantity (including zero). If there's a quantity (including zero), perform the i18n lookup and emit warnings as needed. If there's not a quantity, do what we're doing now.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label Oct 30, 2022
@jmooring jmooring added Keep and removed Stale labels Dec 26, 2022
@jmooring jmooring reopened this Dec 26, 2022
@bep bep added this to the v0.131.0 milestone Jul 22, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants