Page MenuHomePhabricator

@-mention sequence doesn't work on space-less language
Closed, ResolvedPublic

Description

While this makes sense for many languages that use spaces (as foo@bar is more likely to be an email address) it makes it impossible to @-mention in languages that don't use spaces, e.g. Chinese.

Event Timeline

Rewrite the detector to use mw.msg( 'word-separator' ), you think? It'd probably mean that e.g. Chinese is going to get false triggers on email addresses, but that's likely better than it not working at all there.

I noted somewhere else that the word-separator config is not very reliable, for example it set to space in Japanese.

Given it's discouraged to post email address on most of our wikis, perhaps we can just drop the whitespace requirement for now.

It's also not that annoying to have the tool popup when you are trying to write an email address.

Change 604798 had a related patch set uploaded (by DLynch; owner: DLynch):
[mediawiki/extensions/DiscussionTools@master] Don't try to avoid username completion appearing in email addresses

https://gerrit.wikimedia.org/r/604798

...perhaps we can just drop the whitespace requirement for now.

It sounds like 604798 would make it so the @-mention sequence will work on space-less languages tho, the @-mention sequence would also get triggered any time someone types a character that is proceeded by @ (e.g. an email address), regardless of the language they are typing in.

Which leads me to wonder: is it possible for us to make something like the below work?

  • The @-mention sequence will work on space-less languages tho, the @-mention sequence would also get triggered any time someone types a character that is proceeded by @ (e.g. an email address), regardless of the language they are typing in when typing in a space-less language.

Notes

  • ~15,000 Instances of @gmail.com appearing on talk pages at en.wiki: https://w.wiki/Tqf
  • ~25,000 instances of @yahoo.com appearing on talk pages at en.wiki: https://w.wiki/Tqg
  • ~17,000,000 instances of UTC appearing on talk pages at en.wiki: https://w.wiki/Tqj (proxy for total comments)

@ppelberg we don't have a great deal of useful visibility into what language a user is currently typing in. We know what language the UI is currently set to... but that's not particularly reliable in terms of word-separators, as Ed mentioned above.

That said, I guess we could switch from "is there a space before the @? then it's okay to launch completion" to "is there a non-alphanumeric character before the @? then it's okay to launch completion". I'm hypothesizing that spaceless languages probably won't be using the ASCII range, having not actually researched that at all.

@ppelberg we don't have a great deal of useful visibility into what language a user is currently typing in. We know what language the UI is currently set to... but that's not particularly reliable in terms of word-separators, as Ed mentioned above.

Got it, ok.

That said, I guess we could switch from "is there a space before the @? then it's okay to launch completion" to "is there a non-alphanumeric character before the @? then it's okay to launch completion". I'm hypothesizing that spaceless languages probably won't be using the ASCII range, having not actually researched that at all.

If...

  1. ...you see a clear path to finding out the extent to which the following is true to "...spaceless languages probably won't be using the ASCII range..." AND
  2. ...you are confident the "...is there a non-alphanumeric character before the @? then it's okay to launch completion". heuristic will be reliable, let's implement it.

If "1." and "2." end up not being true, let's stick with what you and Ed came to in 604798.

non-alphanumeric

This doesn't work - you are trying to distinguish between a character that could be part of an email address and a character that's part of a script that typically doesn't use spaces, but that distinction is never going to be clear.

Change 604798 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Don't try to avoid username completion appearing in email addresses

https://gerrit.wikimedia.org/r/604798