New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a hreftranslate attribute #3870

Open
wants to merge 4 commits into
base: master
from

Conversation

6 participants
@dtapuska
Copy link
Contributor

dtapuska commented Jul 31, 2018

Proposal from https://github.com/dtapuska/html-translate

Fixes #2945


馃挜 Error: Wattsi server error 馃挜

PR Preview failed to build. (Last tried on Dec 14, 2018, 6:51 PM UTC).

More

馃敆 Related URL

Parsing MDN data...
Parsing caniuse.com data...
Processing caniuse.com data...
Parsing...
Generating HTML variant...
Error: Missing reference: [PAINTTIMING]
Error count: 1
Saving index-html
Splitting...
Saving index.html
Saving introduction.html
Saving infrastructure.html
Saving common-microsyntaxes.html
Saving urls-and-fetching.html
Saving common-dom-interfaces.html
Saving structured-data.html
Saving dom.html
Saving semantics.html
Saving sections.html
Saving grouping-content.html
Saving text-level-semantics.html
Saving links.html
Saving edits.html
Saving embedded-content.html
Saving images.html
Saving iframe-embed-object.html
Saving media.html
Saving image-maps.html
Saving embedded-content-other.html
Saving tables.html
Saving forms.html
Saving input.html
Saving form-elements.html
Saving form-control-infrastructure.html
Saving interactive-elements.html
Saving scripting.html
Saving canvas.html
Saving custom-elements.html
Saving semantics-other.html
Saving microdata.html
Saving interaction.html
Saving dnd.html
Saving browsers.html
Saving window-object.html
Saving origin.html
Saving history.html
Saving browsing-the-web.html
Saving offline.html
Saving webappapis.html
Saving dynamic-markup-insertion.html
Saving timers-and-user-prompts.html
Saving system-state.html
Saving imagebitmap-and-animations.html
Saving comms.html
Saving server-sent-events.html
Saving web-sockets.html
Saving web-messaging.html
Saving workers.html
Saving webstorage.html
Saving syntax.html
Saving parsing.html
Saving named-characters.html
Saving xhtml.html
Saving rendering.html
Saving obsolete.html
Saving iana.html
Saving indices.html
Saving references.html
Saving acknowledgements.html
Generating DEV variant...
Warning: Could not find ID selector-read-only for annotation that uses URLs:
   https://caniuse.com/#feat=css-read-only-write
Splitting...
Saving index.html
Saving introduction.html
Saving infrastructure.html
Saving common-microsyntaxes.html
Saving urls-and-fetching.html
Saving common-dom-interfaces.html
Saving dom.html
Saving semantics.html
Saving sections.html
Saving grouping-content.html
Saving text-level-semantics.html
Saving links.html
Saving edits.html
Saving embedded-content.html
Saving images.html
Saving iframe-embed-object.html
Saving media.html
Saving image-maps.html
Saving embedded-content-other.html
Saving tables.html
Saving forms.html
Saving input.html
Saving form-elements.html
Saving form-control-infrastructure.html
Saving interactive-elements.html
Saving scripting.html
Saving canvas.html
Saving custom-elements.html
Saving semantics-other.html
Saving microdata.html
Saving interaction.html
Saving dnd.html
Saving browsers.html
Saving window-object.html
Saving origin.html
Saving history.html
Saving browsing-the-web.html
Saving offline.html
Saving webappapis.html
Saving dynamic-markup-insertion.html
Saving timers-and-user-prompts.html
Saving system-state.html
Saving imagebitmap-and-animations.html
Saving comms.html
Saving server-sent-events.html
Saving web-sockets.html
Saving web-messaging.html
Saving workers.html
Saving webstorage.html
Saving syntax.html
Saving named-characters.html
Saving xhtml.html
Saving obsolete.html
Saving indices.html
Saving references.html
Saving acknowledgements.html
Generating SNAP variant...
Error: Missing reference: [PAINTTIMING]
Error count: 1
Saving index-snap



If the error is not surfaced properly, please file an issue.

@dtapuska

This comment has been minimized.

Copy link
Contributor

dtapuska commented Jul 31, 2018

@domenic PTAL

@domenic
Copy link
Member

domenic left a comment

Generally looks good! Some small suggestions on ways to make things clearer, and one question around the IDL attribute casing.

And of course still needs multi-implementer interest before we can merge, but it's great to have the proposed semantics formalized and written down.

source Outdated
@@ -19435,6 +19436,7 @@ interface <dfn>HTMLAnchorElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-a-rel">rel</span>;
[SameObject, PutForwards=<span data-x="dom-DOMTokenList-value">value</span>] readonly attribute <span>DOMTokenList</span> <span data-x="dom-a-relList">relList</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-a-hreflang">hreflang</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-a-hreftranslate">hreftranslate</span>;

This comment has been minimized.

@domenic

domenic Aug 1, 2018

Member

Hmm. Normally the IDL attribute should be camel-cased, hrefTranslate. But for some reason hreflang is not. Unsure which type of consistency we should side with... I'm OK with hreftranslate as the default, unless others have thoughts to the contrary.

This comment has been minimized.

@dtapuska

dtapuska Aug 9, 2018

Contributor

I made it hrefTranslate it seems not to deviate from the rest of the examples no?

This comment has been minimized.

@annevk

annevk Aug 9, 2018

Member

It deviates from hreflang.

source Outdated
<p>The IDL attribute <dfn><code data-x="dom-a-hreftranslate">hreftranslate</code></dfn> must
<span>reflect</span> the <code data-x="attr-hyperlink-hreftranslate">hrefttranslate</code>
content attribute. If the UA does not support a client side translation service this attribute
must not be supported.</p>

This comment has been minimized.

@domenic

domenic Aug 1, 2018

Member

UA -> "user agent".

Maybe "this IDL attribute must not be implemented, to allow feature detection"?

This comment has been minimized.

@dtapuska

dtapuska Aug 9, 2018

Contributor

Done

source Outdated
provides the desired translation language of the linked resource. The value must be a valid BCP 47
language tag. <ref spec=BCP47> When nativating the anchor, user agents that support client side
translation should invoke the translation engine providing the value of the attribute.
User agents that do not have a client side translation must not support this attribute

This comment has been minimized.

@domenic

domenic Aug 1, 2018

Member

This paragraph is about the content attribute, not the IDL attribute. It's unclear what "support this attribute" would mean in this context.

I'd either just remove this, or make it a separate <p class="note"> referring to the above requirement on the IDL attribute.

This comment has been minimized.

@dtapuska

dtapuska Aug 9, 2018

Contributor

Done

source Outdated
translation should invoke the translation engine providing the value of the attribute.
User agents that do not have a client side translation must not support this attribute
so that feature detection of this feature is possible.</p>

This comment has been minimized.

@domenic

domenic Aug 1, 2018

Member

It would be good to insert an example here (see <div class="example"> elsewhere for basic structure), especially one showing a link with different hreftranslate and hreflang attributes, and explaining why an author would use each of them.

This comment has been minimized.

@dtapuska

dtapuska Aug 9, 2018

Contributor

Done

source Outdated
<code>a</code> elements that create <span data-x="hyperlink">hyperlinks</span>, if present,
provides the desired translation language of the linked resource. The value must be a valid BCP 47
language tag. <ref spec=BCP47> When nativating the anchor, user agents that support client side
translation should invoke the translation engine providing the value of the attribute.

This comment has been minimized.

@domenic

domenic Aug 1, 2018

Member

"should invoke the translation engine providing the value of the attribute" is not really clear enough. Maybe just adding "as the destination language" or similar phrasing would clear it up.

This comment has been minimized.

@dtapuska

dtapuska Aug 9, 2018

Contributor

Done

source Outdated
translation should display the page in the desired language.</p>

<div class="example">
<p>The following example shows how you can specify different hreflang and hreftranlsate attribute.

This comment has been minimized.

@domenic

domenic Aug 9, 2018

Member

<code with appropriate data-x around the two attribute names. Also mispelled "translate".

This comment has been minimized.

@dtapuska

dtapuska Aug 20, 2018

Contributor

done

source Outdated

<div class="example">
<p>The following example shows how you can specify different hreflang and hreftranlsate attribute.
In this example the links are in German and French but will be translated to English when

This comment has been minimized.

@domenic

domenic Aug 9, 2018

Member

Maybe "the linked resources are in"

This comment has been minimized.

@dtapuska

dtapuska Aug 20, 2018

Contributor

done

source Outdated
@@ -19576,6 +19580,11 @@ interface <dfn>HTMLAnchorElement</dfn> : <span>HTMLElement</span> {
data-x="dom-a-type">type</code></dfn>, must <span>reflect</span> the respective content attributes
of the same name.</p>

<p>The IDL attribute <dfn><code data-x="dom-a-hreftranslate">hreftranslate</code></dfn> must

This comment has been minimized.

@domenic

domenic Aug 9, 2018

Member

You changed to hrefTranslate (capital T) above, but not here.

As noted previously, I'm not sure which we should pick. But, they should be consistent :).

This comment has been minimized.

@annevk

annevk Aug 9, 2018

Member

I think global consistency trumps local consistency, especially given that the precedent isn't a widely used IDL attribute (afaik).

This comment has been minimized.

@dtapuska

dtapuska Aug 10, 2018

Contributor

Fixed

@annevk annevk added the needs tests label Aug 10, 2018

source Outdated
<p>The <dfn><code data-x="attr-hyperlink-hreftranslate">hreftranslate</code></dfn> attribute on
<code>a</code> elements that create <span data-x="hyperlink">hyperlinks</span>, if present,
provides the desired translation language of the linked resource. The value must be a valid BCP 47
language tag. <ref spec=BCP47> When nativating the anchor, user agents that support client side

This comment has been minimized.

@r12a

r12a Aug 15, 2018

Collaborator

Is 'nativating' a typo, or a word i'm not familiar with?

This comment has been minimized.

@r12a

r12a Aug 15, 2018

Collaborator

Reading further, looks like it should be 'navigating'.

This comment has been minimized.

@dtapuska

dtapuska Aug 20, 2018

Contributor

Yes sorry. Fixed typo.

@r12a

This comment has been minimized.

Copy link
Collaborator

r12a commented Aug 15, 2018

I still have strong migivings about his attribute and what it is meant to do. Please see #2945 (comment)

dtapuska added some commits Jul 31, 2018

Refine hrefTranslate
- Adjust IDL to be camelcase
- Add example
- Remove supported text around content attribute
Minor fixes
- Fix typo s/nativating/navigating
- Add cross references for attributes
- Fix translate typo

@dtapuska dtapuska force-pushed the dtapuska:href_translate branch from afbb8cc to dba282f Aug 20, 2018

@dtapuska dtapuska referenced this pull request Aug 23, 2018

Open

hrefTranslate attribute #301

3 of 5 tasks complete
@chrisdavidmills

This comment has been minimized.

Copy link

chrisdavidmills commented Oct 31, 2018

Potential documentation need recorded on MDN content roadmap at https://trello.com/c/CGD3jgk5/128-add-a-hreftranslate-attribute

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