Page MenuHomePhabricator

Support trailing whitespace in messages
Open, MediumPublic

Description

Often trailing whitespace in messages is a "bug" and it can be safely removed. However, in some cases trailing whitespace is intentional: for example around messages defining separators or lego messages (which should be avoided).

Since MediaWiki trims trailing space from pages, we cannot natively support them. While it may be technically possible to remove this trimming, I think better user experience is reached with an explicit "end of message" marker.

In fact, the Gettext file format support already implements this by appending \ at the end of messages that contain whitespace. This should be promoted to be supported in all file based messages. The most important and controversial question is of course how to indicate end of message. Some candidates are:

  • SYMBOL FOR END OF TEXT: (this would be semantically appropriate)
  • Pilcrow: (used by Word between paragraphs)
  • Not sign: ¬ (used by code editor syntax highlighter to indicate line breaks)
  • Backslash: \ (used by Gettext support already)

It doesn't need to be a single characters of course. Being easy to type from a keyboard is a plus, but in practice I doubt it is an issue if we provide an insertable (and copy paste from definition also works). Ideally it should rarely be (in the end of) messages for other reasons.

The logic would be as follows:

  • When reading from files, if the message ends in whitespace, or in the symbol itself, append the marker
  • When exporting, remove one marker from the end

After this, FindUnsynchronizedMessageDefinitions script no longer needs the whitespace ignoring option. Since trailing whitespace is a strong indicator for a bug, we probably should add a new script to list messages with trailing whitespace.