wikimedia / banana-checker

Development has moved to Wikimedia GitLab
https://gitlab.wikimedia.org/repos/ci-tools/banana-checker/
MIT License
8 stars 4 forks source link

disallowBlankTranslations should allow exceptions #69

Open niedzielski opened 5 years ago

niedzielski commented 5 years ago

The disallowBlankTranslations option is global and useful to enable. However, some strings support an empty state and should be excluded. This circumstance occurred recently for a string in MobileFrontend.. The translator wishes to suppress this messaging but it is not permitted by banana checker.

Krinkle commented 5 years ago

Yep, for the same reason, this rule is also disabled in MediaWiki core.

Perhaps one way to make this work is to build on top of the existing conventions we have that communicate with translatewiki.net translators. In particular, we use the {{Ignore}} and {{Optional}} annotations in the qqq-entry for interface messages that are intentionally left empty.

Banana checker could look for that, and tolerance emptiness in those case.

jdlrobson commented 5 years ago

Can {{Ignore}} be used in translations themselves or just qqq at the moment?

Krinkle commented 5 years ago

@jdlrobson I'm not sure I understand the question, or rather, why.

It is technically valid for the characters {{Ignore}} to be used as part of a translation, as would be any other (wiki)text. But doing that would (and should), in that case, be considered an actual translation - not something for a linter to inspect and think about.

Within the localisation system, we've designated exactly one non-language message file to host information that isn't intended for end-users as a translation: qqq. (That is uselang=qqq will fallback to uselang=en the same way uselang=somethingelseinvalid would).

Instead, the qqq values are shown to translators on translatewiki.net where there is conventions and semi-automation in place around its format. Including these template tags, which Niklas and Raimond monitor to update their "Ignore" list in the configuration of the translation software (source) - this in turn excludes these messages from the list of "Messages needing translation" in their UI, etc. It's an existing convention we can leverage by having banana-checker inspect qqq values for things like {{Ignore}}

Having said that, I'm quite open to solving this a different way. Is there a different place you have in mind to store this information?

jdforrester commented 5 years ago

I'm not in love with inspecting the values of qqq messages, but if that's the only sane way forward so be it. Changing disallowBlankTranslations to accept an allowList would be pretty easy, but it sounds like that wouldn't suffice?

Krinkle commented 5 years ago

The main reason I'd like to explore inspecting {{Ignore}} is because that is currently the canonical indicator as used by translatewiki for the same purpose.

We could require developers to manually enumerate all keys they want to ignore, but then they would still also have to set their documentation keys to {{Ignore}}. At that point, it seems more efficient for everyone if we use that as our declarative interface directly.

jdforrester commented 5 years ago

My concerns about this are two-fold:

Also, PR #74 will fixe the request as opened, but let's leave this open for wider discussion?