Repository navigation
Conversation
lutien
left a comment
There was a problem hiding this comment.
That looks good to me, thanks!
setLocaleOverride and setTimezoneOverride commandssetLocaleOverride and setTimezoneOverride commands
|
Thanks for the review, @lutien! Vadim, could you please do an editorial check. Thanks! |
pepelsbey
left a comment
There was a problem hiding this comment.
Looks good! Thank you 🙂
A few suggestions.
| The command changes the default locale used by internationalization APIs such as [`Intl.DateTimeFormat`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat). | ||
| It also changes the language preferences exposed through [`navigator.language`](/en-US/docs/Web/API/Navigator/language) and [`navigator.languages`](/en-US/docs/Web/API/Navigator/languages). | ||
|
|
||
| The command also sets the [`Accept-Language`](/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language) request header to the overridden locale when the request does not already specify that header. |
There was a problem hiding this comment.
| The command changes the default locale used by internationalization APIs such as [`Intl.DateTimeFormat`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat). | |
| It also changes the language preferences exposed through [`navigator.language`](/en-US/docs/Web/API/Navigator/language) and [`navigator.languages`](/en-US/docs/Web/API/Navigator/languages). | |
| The command also sets the [`Accept-Language`](/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language) request header to the overridden locale when the request does not already specify that header. | |
| The command changes the default locale used by internationalization APIs such as {{jsxref("Intl.DateTimeFormat")}}. | |
| It also changes the language preferences exposed through {{domxref("Navigator.language", "navigator.language")}} and {{domxref("Navigator.languages", "navigator.languages")}}. | |
| The command also sets the {{HTTPHeader("Accept-Language")}} request header to the overridden locale when the request does not already specify that header. |
Using macros
| The command changes the default time zone used by date and time APIs such as [`Intl.DateTimeFormat`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat). | ||
| It also changes the local time zone used by [`Date`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) methods such as [`getHours()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours) and [`getTimezoneOffset()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset). |
There was a problem hiding this comment.
| The command changes the default time zone used by date and time APIs such as [`Intl.DateTimeFormat`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat). | |
| It also changes the local time zone used by [`Date`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) methods such as [`getHours()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours) and [`getTimezoneOffset()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset). | |
| The command changes the default time zone used by date and time APIs such as {{jsxref("Intl.DateTimeFormat")}}. | |
| It also changes the local time zone used by {{jsxref("Date")}} methods such as {{jsxref("Date.prototype.getHours()", "getHours()")}} and {{jsxref("Date.prototype.getTimezoneOffset()", "getTimezoneOffset()")}}. |
| sidebar: webdriver | ||
| --- | ||
|
|
||
| The `emulation.setLocaleOverride` [command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`emulation`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/emulation) module overrides the locale for the specified [top-level contexts](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext#top-level_context) or [user contexts](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#user_contexts). |
There was a problem hiding this comment.
| The `emulation.setLocaleOverride` [command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`emulation`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/emulation) module overrides the locale for the specified [top-level contexts](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext#top-level_context) or [user contexts](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#user_contexts). | |
| The `emulation.setLocaleOverride` [command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`emulation`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/emulation) module overrides the {{glossary("locale")}} for the specified [top-level contexts](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext#top-level_context) or [user contexts](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#user_contexts). |
| @@ -1,2 +1,2 @@ | |||
| --- | |||
| title: emulation module | |||
There was a problem hiding this comment.
| title: "`emulation` module" |
While we’re at it
| Suppose you have a web page that formats dates using the browser's default locale, and you want to verify that it displays dates in French when the locale is `fr-FR`. | ||
|
|
||
| First, open a tab using [`browsingContext.create`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/create), which returns its context ID. | ||
| Then load the page you're testing. |
There was a problem hiding this comment.
| Then load the page you're testing. | |
| Then load the page you're testing using [`browsingContext.navigate`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/navigate). |
Maybe linking this one, too?
| Context IDs are returned by commands such as [`browsingContext.getTree`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/getTree). | ||
| This field cannot be used if [`userContexts`](#usercontexts) is also specified, but it is required if `userContexts` is not specified. | ||
| - `timezone` | ||
| - : A string that specifies an available [named time zone identifier or time zone offset string](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime#time_zones_and_offsets), such as `"Asia/Tokyo"` or `"+09:00"`. |
There was a problem hiding this comment.
| - : A string that specifies an available [named time zone identifier or time zone offset string](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime#time_zones_and_offsets), such as `"Asia/Tokyo"` or `"+09:00"`. | |
| - : A string that specifies an available [named time zone identifier or time zone offset string](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime#time_zones_and_offsets), such as `Asia/Tokyo` or `+09:00`. |
For consistency with other pages.
| - Neither `contexts` nor `userContexts` is specified. | ||
| - `contexts` or `userContexts` is an empty array. | ||
| - A context specified in `contexts` is not a top-level context. | ||
| - `timezone` is neither `null` nor a valid time zone offset string nor an available named time zone identifier. |
There was a problem hiding this comment.
| - `timezone` is neither `null` nor a valid time zone offset string nor an available named time zone identifier. | |
| - `timezone` is not `null` and is neither a valid time zone offset string nor an available named time zone identifier. |
It would be easier to read.
| Suppose you have a web page that displays event times in the browser's default time zone, and you want to verify that it displays them in Tokyo's time zone when the override is `Asia/Tokyo`. | ||
|
|
||
| First, open a tab using [`browsingContext.create`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/create), which returns its context ID. | ||
| Then load the page you're testing. |
There was a problem hiding this comment.
| Then load the page you're testing. | |
| Then load the page you're testing using [`browsingContext.navigate`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/navigate). |
Same as above.
| "type": "success", | ||
| "id": 1, |
There was a problem hiding this comment.
| "type": "success", | |
| "id": 1, | |
| "id": 1, | |
| "type": "success", |
|
|
||
| - [`browser.getUserContexts`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/getUserContexts) command | ||
| - [`browsingContext.create`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/create) command | ||
| - [`browsingContext.getTree`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/getTree) command |
There was a problem hiding this comment.
| - [`browsingContext.getTree`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/getTree) command | |
| - [`browsingContext.getTree`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browsingContext/getTree) command | |
| - [`emulation.setLocaleOverride`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/emulation/setLocaleOverride) command |
Would be relevant here too.
|
This pull request has merge conflicts that must be resolved before it can be merged. |
Description
This PR adds pages for two emulation module commands:
emulation.setLocaleOverrideemulation.setTimezoneOverrideSpec links
Related issues and pull requests
Project tracker: mdn/mdn#851
Previous
emulationcommand PR:setGeolocationOverridecommand #46498