Skip to content

(i18n) Relationship between dir and the content #1494

Closed

Description

@iherman

The i18n self test says:

Specify that consumers of strings should use heuristics, preferably based on the Unicode Standard first-strong algorithm, to detect the base direction of a string except where metadata is provided. more (emphasis is mine, I.H.)

This requirement seems to be contradicted by the spec. At the moment, the EPUB 3.3 spec says

Inherent directionality specified using [Unicode] takes precedence over this attribute.

The way I can read this is that the first-strong algorithm in Unicode wins over the value of the dir attribute.

That would certainly be wrong; the Publication Manifest example shows the situation where the value of dir must be followed in contrast to the first strong algorithm.

Maybe that was not the intention in the EPUB spec, but then it needs clarification.

Activity

  1. OriKuttner commented on Jan 30, 2021

    @OriKuttner
  2. iherman commented on Jan 31, 2021

    @iherman
    MemberAuthor

    Here is the full section on the dir attribute in the 3.3 version:

    dir
    Specifies the base text direction of the content and attribute values of the carrying element and its descendants.

    Inherent directionality specified using [Unicode] takes precedence over this attribute.

    Allowed values are ltr (left-to-right) and rtl (right-to-left).

    Where do you see the "except where metadata is provided" note?

    (I would be happy to be proven wrong!)


    It is the same as in the 3.2 version, i.e., this is not a matter of editorial issue when 3.3 was created out of the 3.2 specs.

  3. mattgarrish commented on Jan 31, 2021

    @mattgarrish
    Member

    This goes back to the original 3.0 specification. I don't have any insight into the specifics of it (probably came from the EGLS group?), but I'm not sure I read it the same way.

    What it seems to be saying to me is that if there is strong directionality in the text, that has precedence -- just because dir says the text is ltr, for example, doesn't mean that setting overrides an rtl run within it. I don't expect the intent was that if you find any directionality at the text level that supersedes the attribute.

    But, in any case, it could certainly stand for clarification.

  4. mattgarrish commented on Jan 31, 2021

    @mattgarrish
    Member

    What about wording more along these lines:

    "If an element mixes text runs with different directionalities, the [Unicode] directionality of a text run takes precedence over the dir attribute where they differ."

  5. OriKuttner commented on Jan 31, 2021

    @OriKuttner
  6. added
    i18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.
    on Jan 31, 2021
  7. iherman commented on Jan 31, 2021

    @iherman
    MemberAuthor

    I think the dir attribute should take precedence.

    I agree. I also think that this is the advice given by the i18n experts at W3C.

    Switching on the I18n label to request an input from the i18n people

  8. iherman commented on Jan 31, 2021

    @iherman
    MemberAuthor

    What it seems to be saying to me is that if there is strong directionality in the text, that has precedence -- just because dir says the text is ltr, for example, doesn't mean that setting overrides an rtl run within it. I don't expect the intent was that if you find any directionality at the text level that supersedes the attribute.

    The example in the pub manifest is exactly the case where this would go wrong. The first strong directionally would be given by the letter 'H' and you need the extra metadata to overwrite this to get the Hebrew text right.

  9. murata2makoto commented on Jan 31, 2021

    @murata2makoto
    Contributor

    I don't have any insight into the specifics of it (probably came from the EGLS group?), but I'm not sure I read it the same way.

    I am afraid that I have no ideas. The recommendations from the EGLS subgroup does not mention the dir attribute.

  10. matial commented on Feb 2, 2021

    @matial

    The spec is not clear, but the requirement is simple IMHO. The dir attribute should be used to specify what Unicode (UAX #9 - Unicode Bidirectional Algorithm)) calls the paragraph direction (also called "base direction"), no less no more. The base direction does not override the inherent direction of text runs within the element but affects how those runs are ordered relatively to each other for display.

  11. r12a commented on Feb 3, 2021

    @r12a

    For determining the base direction of strings or inline insertions, the i18n WG recommends that first-strong heuristics be used by default to detect base direction, but those heuristics fail if a string begins with a character which has an opposite direction to the string as a whole (such as a book title in Arabic that begins with 'HTML'). For those cases there needs to be a way to explicitly override the heuristics, which is what the dir attribute does.

    The dir attribute is also useful for setting a direction that will be inherited through a whole document or sections of a document, eg. at the top of an HTML file.

    Setting a dir attribute is an explicit choice, and must therefore always override the application of heuristics unless the auto value is set.

    hth

  12. iherman commented on Feb 9, 2021

    @iherman
    MemberAuthor

    The issue was discussed in a meeting on 2021-02-04

    List of resolutions:

    • Resolution No. 2: Fix 1494 by removing the untrue statement about the relationship between dir and the underlying text
    View the transcript

    2. Relationship between dir and the content

    See github issue #1494.

    Dave Cramer: i18n self test says what is in the ticket
    … spec specifies that directionality in unicode takes precedence
    … over the dir attribute
    … Matt says if there's strong directionality in the text, that takes precedence
    … dir doesn't control everything
    … see r12a's comments
    … what Richard says there makes sense
    … we need to remove that line in the spec stating that unicode directionality takes precedence
    … it would conflict with the guidance from Richard
    … address the issue by having Matt removing that bit and clarifying the text
    … the relationship between the string and the dir attribute
    … any opposition?

    Ben Schroeter: The change being that dir wins?

    Dave Cramer: Removing the line that says strings can override dir

    Brady Duga: I don't think anyone knows what it means
    … dir sets the base direction
    … but it has nothing to do with unicode for instance
    … the unicode API does that
    … we're reaching
    … we should just say "this is what dir does"

    Dave Cramer: This is a lesson, if you get that deep into it, it's confusing

    Proposed resolution: Fix 1494 by removing the untrue statement about the relationship between dir and the underlying text (Wendy Reid)

    Resolution #2: Fix 1494 by removing the untrue statement about the relationship between dir and the underlying text

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    EPUB33Issues fixed in the EPUB 3.3 revisionSpec-EPUB3The issue affects the core EPUB 3.X Recommendationi18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions