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

Validate placeholders in locales against default locale #5437

Open
xPaw opened this issue Sep 10, 2024 · 1 comment
Open

Validate placeholders in locales against default locale #5437

xPaw opened this issue Sep 10, 2024 · 1 comment

Comments

@xPaw
Copy link

xPaw commented Sep 10, 2024

For example:

english:

	"app_lowest_price": {
		"message": "SteamDB lowest recorded price is <b>$price$</b>",
		"placeholders": {
			"price": {
				"content": "$1",
				"example": "1,99€"
			}
		}
	},

another locale:

	"app_lowest_price": {
		"message": "Минимальная зафиксированная цена на SteamDB — <b>$price$</b>",
		"placeholders": {
			"price": {
				"content": "$2",
				"example": "1,99€"
			}
		}
	},

I would like this produce a warning because the placeholder in the non default locale uses "$2" instead of "$1".

@rpl
Copy link
Member

rpl commented Oct 24, 2024

We briefly discussed about this issue in our triage meeting today and agreed that this would be a reasonable enhancement to the locale files validation.

The idea could be to validate that the placeholders that are used in the en-US locale are being matched by the placeholders included in the other locales.

As a side note, introducing that kind of additional check may likely require changes to JSONScanner, which is defined in https://github.com/mozilla/addons-linter/blob/c3fa9a64507957821f58138c1fdd2d186c2987a8/src/scanners/json.js

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