Skip to content

[css-content] Quote character choice must depend on surrounding language, not language of the quotation #5478

Open

Description

@r12a

2.4.1. Specifying quotes with the quotes property
https://drafts.csswg.org/css-content/#quotes-property

auto
A typographically appropriate used value for quotes is automatically chosen by the UA based on the content language of the element and/or its parent.

Note: The Unicode Common Locale Data Repository [CLDR] maintains information on typographically appropriate quotation marks. UAs can use other sources of information as well, particularly as typographic preferences can vary; however it is encouraged to submit any improvements to Unicode so that the entire software ecosystem can benefit.

The i18n WG raised an issue related to the Rendering section of the HTML spec because current implementations choose quote marks based on the language of the quotation, rather than the language of the surrounding text. This is wrong, and needs to be fixed.

It is noticeable when the language of the quotation is different from that of the surrounding text. See these tests:

Since the HTML spec is now to have that section removed (due to introduction of the auto value for the quotes property), we need this requirement to be made clear in the CSS spec.

[Note, btw, that contrary to the request at the start of the HTML thread mentioned above (https://github.com/whatwg/html/issues/3636), it is important to base the choice of quotes on the language of the immediately surrounding text, not the language of the html tag (as is made clearer further down the discussion thread).]

It would also help to include a note showing how content authors can make their styling produce the correct results (since it's far from straightforward, and it will no longer be possible to point to examples in the HTML spec).

Activity

  1. added
    i18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.
    on Aug 27, 2020
  2. added
    i18n-needs-resolutionIssue the Internationalization Group has raised and looks for a response on.
    and removed
    i18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.
    on Sep 3, 2020
  3. fantasai commented on Sep 23, 2020

    @fantasai
    Collaborator

    A few key comments from that other issue:

    It would be easy to say that auto resolves based on the parent content language rather than the element's own, and I think we should definitely at least do that.

    The next consideration is whether we want to get the q { quotes: inherit; } behavior required to get consistent quoting conventions through multiple levels of quotation. Given that auto inherits as itself, it would require some other keyword (like the match-parent keyword we have added to text-align) to resolve the computed value to a specific quoting convention.

  4. css-meeting-bot commented on Sep 30, 2020

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-content] Quote character choice must depend on surrounding language, not language of the quotation, and agreed to the following:

    • RESOLVED: auto value of quote to be based on parent language
    • RESOLVED: Add match-parent keyword
    The full IRC log of that discussion <dael> Topic: [css-content] Quote character choice must depend on surrounding language, not language of the quotation
    <dael> github: https://github.com//issues/5478
    <dael> fantasai: The question raised is we have an atuo keyword for quotes property. Richard points out set you want to use is the set of the parent, not the element's language
    <tantek> wow I thought we solved that with the Q element back in the day
    <dael> fantasai: Do we want to resolve to define auto value of quote to choose based on parent's content language rather then element's content language?
    <dael> Rossen_: Comments?
    <fantasai> tantek, this is how the Q element is implemented
    <fremy> this seems to make sense
    <dael> ??: Works for me and I see Richard's point. Good issue.
    <faceless2> s/??/faceless2
    <dael> tantek: Agree as well. I thought we did that in E5 Mac for Q element. We should look at Q element
    <dael> fantasai: Q element is defined in CSS terms. So we need to fix our spec.
    <tantek> s/E5/IE5
    <dael> Rossen_: Objections to resolve auto value of quote to be based on parent language
    <dael> RESOLVED: auto value of quote to be based on parent language
    <dael> fantasai: Second part of issue
    <fantasai> https://github.com/whatwg/html/issues/3636#issue-316269336
    <fantasai> But Lucy replied: “Embrassez George de ma part et dites-lui, ‘Embrouille’”
    <dael> fantasai: If you have quote within a quote you will typically use quotation style of contextual language not immediate parent.
    <dael> fantasai: Previously when didn't have auto some discussion on how to do that with selectors and ^ have examples
    <dael> fantasai: auto inherits as itself. No way to get that behavior of I am using the quotation marks of my context.
    <dael> fantasai: Can get the behavior but need keyword like match-parent. Aline has that to use same resolved alignment as parennt
    <florian> s/Aline/align/
    <dael> fantasai: We added match-parent which says look at my parent value and if it's phsyical inherit. Logical resolve and inherit
    <florian> s/Aline/text-align/
    <dael> fantasai: Can do similar here where if my parent value is similar to quote inherit. If it's auto, resolve that to a string and set my computed value to that string and it inherits through.
    <Rossen_> q
    <dael> florian: Would that be what match-parent does? I think you want to match style but not string.
    <AmeliaBR> Quotes already need to keep track of nesting, so can't auto have a behavior that if this is a nested quote, use the same language quotes as the outer level?
    <dael> fantasai: Nesting if from open/close quote
    <dael> florian: Yes, yes.
    <dael> fantasai: Keeping track of nesting we don't have to worry about here. Nesting levels is defined and UA is responcible to choose correct.
    <dael> fantasai: Do we want to add a match-parent keyword?
    <florian> I think we do
    <fantasai> s/define/handled by counters built into the content property/
    <dael> Rossen_: I see one support on IRC
    <dael> Rossen_: Other thoughts or reasons why we shouldn't?
    <dael> jfkthame: Unclear. Is match-parent inUA stylesheet or authors expected to do?
    <dael> fantasai: I don't know the answer. If want behavior where using quotation lang of context it's easy in UA stylesheet. That should get correct behavior. If we want that in UA stylesheet I'm less sure but I leave that to i18n and WhatWG. This makes it possible to do
    <fantasai> s/that should/q q { quotes: match-parent; } should
    <dael> florian: Seems that if we want q element to be able to have the range of behaviors needed to use it properly we should do this. If we believe people don't use q element maybe we can skip, but if we want it to be useful we should do this.
    <dael> jfkthame: Then we should do it. I think it's a useful property
    <fantasai> s/jfkthame/faceless2/
    <dael> Rossen_: hearing people leaning toward the optional keyword match-parent.
    <dael> Rossen_: Thoughts of objections to adding match-parent keyword?
    <dael> RESOLVED: Add match-parent keyword
  5. r12a commented on Jan 27, 2021

    @r12a
    ContributorAuthor

    Just wondering about the status of this. It doesn't seem that any edits have yet been made, afaict. It seems to me that something along these lines may be useful.

    [1]

    A typographically appropriate used value for quotes is automatically chosen by the UA based on the content language of the element and/or its parent.

    Replace with something like:

    A typographically appropriate value for quotes is automatically chosen by the UA based on the content language of the q element's parent. Nested q elements use the same content language for values as the first element.

    [2]

    Note: If a quotation is in a different language than the surrounding text, it is customary to quote the text with the quote marks of the language of the surrounding text, not the language of the quotation itself.

    -->

    Note: If a quotation is in a different language than the surrounding text, it is customary to quote the text with the quote marks of the language of the surrounding text, not the language of the quotation itself. Nested quotations continue to use quote marks for the same language as the top-most quotation.

    [3]

     Il disait: « Il faut mettre l’action en ‹ fast forward ›. » 
    

    The quote marks around fast forward seem a little ambiguous to me wrt whether they surround a quotation (as opposed to a foreign term). But it also misses the chance to show French quotes on the outside, too. Maybe you have a reason for choosing that example, or maybe it's better to use the following (or both?).

    Mais Lucy répondit: «Give George my love and tell him, ‹Muddle›».

  6. 55 remaining items

  7. jfkthame commented on Jun 13, 2024

    @jfkthame
  8. added a commit that references this issue on Sep 9, 2026
  9. fantasai commented on Oct 8, 2026

    @fantasai
    Collaborator

    We resolved to define a value with the following behavior:

    RESOLVED: adopt a quotes value that, if the parent's quotes computed value is auto, computes the correct quotes for the parent's language, and if the parent's quotes computed value is not auto, inherits that value

    We did not resolve on a name. @tabatkins and I propose match-parent since this functionally will match the value used by the parent.

  10. astearns commented on Oct 19, 2026

    @astearns
    Member

    Looking through this, we decided to add a match-parent value in 2020, but the definition of that wasn’t quite what we wanted. So we resolved on a different definition to be named later in 2024 and dropped the match-parent value. Now you want to use the old term for the new definition?

  11. tabatkins commented on Oct 19, 2026

    @tabatkins
    Member

    Yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions