-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce navigator.language #12322
Conversation
The spec says the following
And MDN says:
I would argue that if Also an additional note, on unix this would be more or less the same as getting the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing WorkerNavigator typings and property definition in 99_main
Actually, this can be enabled by default (no permissions), because the default language can already be extracted via |
runtime/ops/os.rs
Outdated
fn op_languages( | ||
_state: &mut OpState, | ||
_: (), | ||
_: (), | ||
) -> Result<Vec<String>, AnyError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If locale_config
caches the result it means that this value cannot change after the first call. I'd suggest to remove this op and forward the value to JS in BootstrapOptions
struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a test for navigator.languages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Thanks Ben.
Sorry @AnInternetTroll, accidentally left my review comment on the wrong PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
languages
should be frozen
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Not stale, work has been done in rusty_v8 denoland/rusty_v8#953 |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This is now done and should be ready to land. @lucacasonato @crowlKats please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fly-by review.
@@ -47,6 +48,7 @@ impl Default for BootstrapOptions { | |||
enable_testing_features: Default::default(), | |||
debug_flag: Default::default(), | |||
ts_version: Default::default(), | |||
locale: "en-EN".to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like an error - there's no region EN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Silly mistake on my part, I'll fix it
Pointed by @zbraniecki in #12322 (comment), I made a mistake with default locale value.
Link to the spec: https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language-dev
To accessnavigator.language
you must pass--allow-env
as it can lead to fingerprinting.What this PR doesn't add is
languagechange
which quite frankly is outside of my skill level.