Skip to content

Conversation

@lutien
Copy link
Contributor

@lutien lutien commented Nov 18, 2025

Addresses post-merge review comments on #11793


/system-state.html ( diff )

@lutien lutien force-pushed the address-feedback-on-language-override branch 2 times, most recently from 25c9273 to 322cfa0 Compare November 18, 2025 10:38
source Outdated
languages, ordered by preference with the most preferred language first. <ref>BCP47</ref></li>
languages, ordered by preference with the most preferred language first. The same object must be
returned until the user agent needs to return different values, or values in a different order,
or <var>emulatedLanguage</var> is updated. <ref>BCP47</ref></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do this properly we have to store the object we intend to return on Navigator in an associated concept of sorts. And then each time we run this algorithm we see if any of the values changed, and if not, we return the cached object. And if they have changed, we update the cached object and then return it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I'm not so sure how to specify the storing of the value 😕 Like where I could keep it. I couldn't really find anything similar in the spec, only the same kind of sentences that the value should be returned until something has changed. Should I write something abstract that there should be some kind of cache for it? Could you maybe give me some pointers/examples?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay. It would be similar to

Each Window has an associated Navigator, ...

Maybe something like:

Each object that implements NavigatorLanguage has an associated plausible languages array, which is a frozen array of BCP 47 language tags. It is initially empty.

And then in the getter algorithm you could do something like:

  1. Let languages be the result of computing plausible languages. (I.e., what the steps do today.)
  2. If languages and this's plausible languages array do not have the same values in the same order, then set this's plausible languages array to languages.
  3. Return this's plausible languages array.

Does that help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! It does 🙂
I've updated the PR. Please let me know if it looks better now.

@lutien lutien force-pushed the address-feedback-on-language-override branch 3 times, most recently from 841b0a3 to 5446bae Compare November 21, 2025 18:01
@lutien lutien force-pushed the address-feedback-on-language-override branch from 5446bae to d8a55d5 Compare November 21, 2025 18:04
@lutien lutien force-pushed the address-feedback-on-language-override branch from d8a55d5 to a483bd7 Compare November 21, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants