Page MenuHomePhabricator

Incorrect space in Wikibase edit summaries in Chinese languages
Open, LowPublic

Description

Wikibase creates translatable edit summaries by generating special autocomments –

/* wbsetlabel-set:1|en */ Wikidata sandbox

– which are then turned into HTML via the FormatAutocomments hook when the whole comment/summary is formatted (in the user language):

<span dir="auto"><span class="autocomment">Changed English label: </span></span> Wikidata sandbox
‎<span dir="auto"><span class="autocomment">(wikibase-item-summary-wbsetlabel-set: 1, en)(colon-separator)</span></span> Wikidata sandbox

There are two spaces before the label value: one inside the autocomment, from the colon-separator message (which is : in English), and one outside the autocomment, which is the original space between the */ and the new label. That’s fine, since in HTML adjacent spaces are collapsed (even across elements).

However, this means that the outer space will still be present even if the colon-separator message doesn’t include one. This is the case, for example, in Chinese languages (example edit):

<span dir="auto"><span class="autocomment">已更改[zh-hk]的标签、描述和别名:</span></span> 北京, 中華人民共和國首都, 北京, 京, 北京市

Though my knowledge of Chinese languages is limited, I believe this is incorrect: they don’t use space characters, that’s why the colon-separator message doesn’t include a space character there (it’s just a U+FF1A FULLWIDTH COLON). The visual difference is minor, but it does exist:

Screenshot_2019-03-29 “北京市 (Q956)”的版本间的差异 - Wikidata.png (46×526 px, 17 KB)

This can be fixed by removing the space after the */:

/* wbsetlabel-set:1|en */Wikidata sandbox

This would still look correct in English, since the colon-separator message includes the space there:

<span dir="auto"><span class="autocomment">Changed English label: </span></span>Wikidata sandbox

Event Timeline

@Liuxinyu970226 as someone who speaks Chinese, can you perhaps check whether the extra space in summaries like this one is actually an issue, or whether I misunderstood anything?

Hm, it looks like MediaWiki also adds that space by default in regular edit summaries. (I didn’t try out how this looks when saved and rendered as a proper summary.)

Screenshot_2019-04-05 编辑“小毛口鯰” - 维基百科,自由的百科全书.png (341×500 px, 54 KB)

I'm okay with removing that unnecessary last space.

Thanks! But that sounds like it’s not a pressing issue.