From bd3f3f67a081e2b65515f20693e6c92b4f95c0a5 Mon Sep 17 00:00:00 2001 From: Ehsan Toreini Date: Fri, 15 May 2026 13:48:35 +0100 Subject: [PATCH 1/4] Update index.bs I found this section in explainer is missing in the spec so I added it. --- index.bs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.bs b/index.bs index ccf1db8..fffac64 100644 --- a/index.bs +++ b/index.bs @@ -803,6 +803,20 @@ Access to the language detector API is gated behind the [=policy-controlled feat Please see [[WRITING-ASSISTANCE-APIS#privacy]] for a discussion of privacy considerations for the translator and language detector APIs. That text was written to apply to all APIs sharing the same infrastructure, as noted in [[#dependencies]]. + +

Permissions policy, iframes, and workers

+ +By default, these APIs are only available to top-level `Window`s, and to their same-origin iframes. Access to the APIs can be delegated to cross-origin iframes using the [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) `allow=""` attribute: + + +<iframe src="https://example.com/" allow="translator language-detector"></iframe> + + +These APIs are currently not available in workers, due to the complexity of establishing a responsible document for each worker in order to check the permissions policy status. See [this discussion](https://github.com/webmachinelearning/translation-api/issues/18#issuecomment-2705630392) for more. It may be possible to loosen this restriction over time, if use cases arise. + +Note that although the APIs are not exposed to web platform workers, a browser could expose them to extension service workers, which are outside the scope of web platform specifications and have a different permissions model. + +

Security considerations

Please see [[WRITING-ASSISTANCE-APIS#security]] for a discussion of security considerations for the translator and language detector APIs. That text was written to apply to all APIs sharing the same infrastructure, as noted in [[#dependencies]]. From 823e4055c2e59b1ad038a5e28559cf201db25a11 Mon Sep 17 00:00:00 2001 From: Ehsan Toreini Date: Wed, 22 Jul 2026 14:39:33 +0100 Subject: [PATCH 2/4] [[UPDATED]] added the missing parts on the explainer to the spec --- index.bs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/index.bs b/index.bs index fffac64..04e4143 100644 --- a/index.bs +++ b/index.bs @@ -795,26 +795,29 @@ When language detection fails, the following possible reasons may be surfaced to

This table does not give the complete list of exceptions that can be surfaced by the language detector API. It only contains those which can come from certain [=implementation-defined=] steps. -

Permissions policy integration

- -Access to the language detector API is gated behind the [=policy-controlled feature=] "language-detector", which has a [=policy-controlled feature/default allowlist=] of [=default allowlist/'self'=].

Privacy considerations

Please see [[WRITING-ASSISTANCE-APIS#privacy]] for a discussion of privacy considerations for the translator and language detector APIs. That text was written to apply to all APIs sharing the same infrastructure, as noted in [[#dependencies]]. +

Permissions policy integration

-

Permissions policy, iframes, and workers

+Access to the language detector API is gated behind the [=policy-controlled feature=] "language-detector", which has a [=policy-controlled feature/default allowlist=] of [=default allowlist/'self'=]. -By default, these APIs are only available to top-level `Window`s, and to their same-origin iframes. Access to the APIs can be delegated to cross-origin iframes using the [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) `allow=""` attribute: - -<iframe src="https://example.com/" allow="translator language-detector"></iframe> - +

iFrame Permissions

+ +By default, these APIs are only available to top-level {{Window}} object, and to their same-origin iframes. Access to the APIs can be delegated to cross-origin iframes using the Permissions Policy allow="" attribute: + -These APIs are currently not available in workers, due to the complexity of establishing a responsible document for each worker in order to check the permissions policy status. See [this discussion](https://github.com/webmachinelearning/translation-api/issues/18#issuecomment-2705630392) for more. It may be possible to loosen this restriction over time, if use cases arise. +
+ The translation service available to the top-origin is accessible to the example.com origin through . + + <iframe src="https://example.com/" allow="translator language-detector"></iframe> + +
-Note that although the APIs are not exposed to web platform workers, a browser could expose them to extension service workers, which are outside the scope of web platform specifications and have a different permissions model. +

These APIs are unavailable in workers due to the complexity of setting up a responsible document for each worker to check permissions policy status. For more details, see [this discussion](https://github.com/webmachinelearning/translation-api/issues/18#issuecomment-2705630392). This restriction may be relaxed in the future.

Security considerations

From 55407bd17f0b54f1c325b2cf801738f50c2b0072 Mon Sep 17 00:00:00 2001 From: Ehsan Toreini Date: Fri, 24 Jul 2026 11:20:35 +0100 Subject: [PATCH 3/4] Made changes to the privacy considerations making it more consistent with the explainer --- index.bs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/index.bs b/index.bs index 04e4143..7f38c8d 100644 --- a/index.bs +++ b/index.bs @@ -465,10 +465,6 @@ When translation fails, the following possible reasons may be surfaced to the we

This table does not give the complete list of exceptions that can be surfaced by the translator API. It only contains those which can come from certain [=implementation-defined=] steps. -

Permissions policy integration

- -Access to the translator API is gated behind the [=policy-controlled feature=] "translator", which has a [=policy-controlled feature/default allowlist=] of [=default allowlist/'self'=]. -

The language detector API

@@ -802,22 +798,24 @@ Please see [[WRITING-ASSISTANCE-APIS#privacy]] for a discussion of privacy consi <h3 id="language-detector-permissions-policy">Permissions policy integration</h3> +Access to the translator API is gated behind the [=policy-controlled feature=] "<dfn permission>translator</dfn>", which has a [=policy-controlled feature/default allowlist=] of <code>[=default allowlist/'self'=]</code>. + Access to the language detector API is gated behind the [=policy-controlled feature=] "<dfn permission>language-detector</dfn>", which has a [=policy-controlled feature/default allowlist=] of <code>[=default allowlist/'self'=]</code>. -<h3 id="language-detector-iframe-policy">iFrame Permissions</h3> +<h3 id="language-detector-iframe-policy"><code>iframe</code> Permissions</h3> -By default, these APIs are only available to top-level {{Window}} object, and to their same-origin iframes. Access to the APIs can be delegated to cross-origin iframes using the Permissions Policy allow="" attribute: +By default, these APIs are only available to top-level {{Window}} object, and to their same-origin iframes. Access to the APIs can be delegated to cross-origin iframes using the Permissions Policy <code>allow=""</code> attribute: <div class="example" id="example-language-iframe"> - The translation service available to the top-origin is accessible to the example.com origin through . + The translation service available to the top-origin is accessible to the example.com origin through <code>allow</code> attribute. <xmp class="language-html"> <iframe src="https://example.com/" allow="translator language-detector"></iframe> -

These APIs are unavailable in workers due to the complexity of setting up a responsible document for each worker to check permissions policy status. For more details, see [this discussion](https://github.com/webmachinelearning/translation-api/issues/18#issuecomment-2705630392). This restriction may be relaxed in the future.

+

These APIs are unavailable in workers due to the complexity of setting up a responsible document for each worker to check permissions policy status. For more details, see [this discussion](https://github.com/webmachinelearning/translation-api/issues/18#issuecomment-2705630392). This restriction might be relaxed in the future.

Security considerations

From 78362d1877d867c5e1dd21039c56893722b5deef Mon Sep 17 00:00:00 2001 From: Ehsan Toreini Date: Fri, 24 Jul 2026 11:30:22 +0100 Subject: [PATCH 4/4] trying to fix the validation errors --- index.bs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.bs b/index.bs index 7f38c8d..62bd5de 100644 --- a/index.bs +++ b/index.bs @@ -36,6 +36,13 @@ urlPrefix: https://whatpr.org/webidl/1465.html; spec: WEBIDL text: quota; url: quotaexceedederror-quota + +

Introduction

The translator and language detector APIs expose the ability to translate text between human languages, and detect the language of such text. They are complementary to any built-in browser UI features for these purposes, giving web developers the ability to trigger these operations programmatically and integrate them into their applications. This can be especially useful for operating on user input, or text retrieved from the network.