mozilla / bedrock

Making mozilla.org awesome, one pebble at a time
https://www.mozilla.org
Mozilla Public License 2.0
1.17k stars 912 forks source link

Support automatic linting of translated content #14948

Open stevejalim opened 1 month ago

stevejalim commented 1 month ago

(Draft issue - context may be incorrect)

Context

At the moment, source (English) strings flow from mozilla/bedrock end up in the www-l10n repo, where a custom Github Action lints them to warn of any errors. This linting is blocking, in terms of the strings being exported from Bedrock, but things get fixed promptly.

When they come back from Smartling or Pontoon, they land in https://github.com/mozmeao/www-fluent-update where we run Bedrock's process_ftl management comand that calculates activation percentages after another blocking/hard lint of the strings, then pushes them to another git repo (https://github.com/mozmeao/www-l10n) - but no linting/processing occurs there before they are pulled down into running Bedrock servers.

For the CMS, though, strings will come straight into Wagtail from Smartling (and eventually Pontoon), bypassing the linting via GHA. From the CMS, they will be rendered directly into the live pages. They do not need to be exported to a separate git repo to be used in the site. Equally, CMS-managed strings will not be Fluent format - they are handled via gettext .po files

We need to decide 1) Whether linting needs to happen for CMS-managed strings 2) What linting will take place. Looking at what's described above, if we mirrored it we'd need:

Success criteria

eemeli commented 1 month ago

Within the next few months, I'll be adding linting/validation support to moz.l10n, to replace the current plethora of bespoke L10n linters we use, including e.g. moz-fluent-linter. This will support all of our current formats, including gettext .po files.

It would be very useful for the moz.l10n development work to have Bedrock as an active and interested customer.

stevejalim commented 1 month ago

Thanks @eemeli - in reality, I think it'll be a few months until we're putting significant traffic through the Wagtail CMS<->Smartling integration, so that could fit well. Unless @mathjazz or Team L10N have a strong objection to my suggestion here, I think I'll defer porting any current linter into the Wagtail/Smartling pipeline and wait for the newer linter to land

eemeli commented 1 month ago

@stevejalim Would it be possible to get your requirements/expectations enumerated somehow? That would make it much easier to ensure that the moz.l10n linter will serve your needs from the start.

stevejalim commented 1 month ago

@eemeli Fair point! TBH I don't have the current behaviour in my head, but I can dig out which linting scripts are currently run in our workflow - will that be enough to help?

eemeli commented 1 month ago

From what I could tell, you appear to be using moz-l10n-linter, but if there are others, that would be useful to know. I was actually hoping for more of a description of what sorts of issues you are linting for, what sorts of situations you want a linter for, how you use the validation results, and how configurable all of this needs to be.

But if the ask is just, "something that works", then we can aim for that too and use our own judgement.