Page MenuHomePhabricator

Add language-dependent styling of <q> element
Open, NormalPublic

Description

<q> is a valid wikitext tag, which surrounds its contents with quotes. However, it is not localized: It always displays the English-style quotes.

Something like the following should be added into the global stylesheet:

:lang(en) q { quotes: "“" "”" "‘" "’"; }
:lang(ru) q { quotes: "«" "»" "„" "“"; }
:lang(cs) q { quotes: "„" "“" "," "‘"; }
...

Requested at cswiktionary:WS:PLT.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 16 2017, 6:24 AM

CSS selectors like q:lang(cs) should be added as well, I think.

Iniquity updated the task description. (Show Details)Nov 8 2017, 4:12 AM
ovasileva triaged this task as Normal priority.Nov 9 2017, 10:33 AM
ovasileva moved this task from To Triage to Needs Analysis on the Readers-Web-Backlog board.
Jdlrobson added a subscriber: Jdlrobson.

The Q element is currently in draft and to my knowledge we don't style this anywhere in mediawiki core:
https://dev.w3.org/html5/spec-preview/the-q-element.html

Any styling relates to browser defaults.

Is the Q element used anywhere ?
Why are we using it instead of other more established elements such as blockquote? Should we encourage it?

Iniquity added a comment.EditedNov 9 2017, 10:14 PM

Hm, maybe something changed, but... The 'Q' tag is work fine. Windows Chrome.
https://ru.wikipedia.org/wiki/User:Iniquity/Tag_Q
https://en.wikipedia.org/wiki/User:Iniquity/Tag_Q

Hm, maybe something changed, but... The 'Q' tag is work fine. Windows Chrome.

It will work in wikitext as its valid and safe HTML and browsers will attempt to style it with sensible defaults. Whether it should be encouraged or core should provide styling is a different matter.

Iniquity added a comment.EditedNov 9 2017, 10:38 PM

Yes, FF users have reported about english quotes style for both variants.

Izno added a subscriber: Izno.EditedAug 17 2018, 4:34 AM

The Q element is currently in draft and to my knowledge we don't style this anywhere in mediawiki core:
https://dev.w3.org/html5/spec-preview/the-q-element.html
Any styling relates to browser defaults.
Is the Q element used anywhere ?
Why are we using it instead of other more established elements such as blockquote? Should we encourage it?

<q> has been in HTML since HTML 4.... It is presently used to markup the quoted content output by the cite family on en.wp with associated styling presently appearing both in Common.css and in the new-but-undeployed TemplateStyles page for the cite family module. There might be other places but I don't know them offhand. Other wikis are free to change how they mark their quotations up as that's in that module's config file (and the associated CSS, naturally, at Common.css now or TemplateStyles later).

I am a bit skeptical about adding CSS for it in core, but at least it would provide a bit of a reset. I don't know if one is necessary: browsers may already have standard CSS for it. I believe the advisory section for default CSS in the HTML specification provides some advice on the point.

The provided rules above are a bit problematic because they would change the kind of quotation mark if I were to put the associated markup inside of lang-demarked template--when it should remain constant mostly depending on the style used by the language of the wiki in question. body:lang(en) q and etc. might work okay. There might be differences even within a language; en.wp:WP:MOS requires straight quotation marks for a number of reasons, rather than the curly quotation marks suggested in the description.

There's quite a bit of interesting stuff at a draft i18n Q&A by the W3C. (provided by archive.org) It's a must-read for successful implementation of this task, I think. As well as the further reading at the bottom of the article.

I stand corrected about the status of q in the HTML spec. It's a new one I wasn't aware of. However I still remain confused about where these supposedly problematic styles are coming from. Are there some example pages showcasing the issue?

Im assuming templates able to generate q tags?

If styles are coming from the browser it's very likely a bug there if they are not displaying correctly.

I'm wary of adding styles to core which is not explicitly styling something widely used.

Izno added a comment.Aug 30 2018, 7:03 PM

I'm assuming templates able to generate q tags?

In most cases (as I said, it's emitted now in CS1 templates with the |quote= parameter, and there are some other handful of templates too probably). It could validly be used in wild wikitext, but I have almost never seen that (a search that somehow did not timeout returns all of 78 occurrences in mainspace on en.wp), because most editors prefer to use simple quotation marks (double, single, guillemets, Chinese, others...) instead. Even so, I would guess that most authors on the Web (probably 95%+) use quotation marks inline rather than the q element, for much the same reason as we do on-wiki.

If styles are coming from the browser it's very likely a bug there if they are not displaying correctly.

As that draft I18n Q&A indicates to me, I would be very cautious calling anything a bug in this context. As I noted above, the suggested change to the stylesheets is wrong, anyway.

I'm wary of adding styles to core which is not explicitly styling something widely used.

I'm wary of adding styles to core which varies in its suggested display as much as the q element seems to, regardless of width of use. Specific wikis should probably provide default styling in their Common.css style sheets or their TemplateStyles style sheets which users can then override for their use, either in their personal CSS files onwiki or in their browser.