> Sorry, I don't understand the implications of filtering them out. Where is the filtering being done, what does that affect?
If you pass sth like this:
```js
let requested = ["pl"];
let available = ["en", "b-1-d", "b-e, "pl", "ru", "fr"];
let supported = negotiateLanguages(requested, available);
```
then we have to figure out what to do with `b-1-d` and `b-e`. They are not language identifiers and we won't allow user to ever select such string as a requested locale, so it'll never match.
What we do right now is filter them out, so that the real list of available passed to negotiation is `["en", "pl", "ru", "fr"]` in such a case.
I'd like to strengthen it, initially just issuing a warning if you try to pass invalid locales as available/default, to make it easier to catch when you pass something that is not a Unicode Language Identifier there, rather than just quietly filter them out.
My question is, why is `b-1-d` passed to available locales? It's not a locale. What is it meant to match against? In which scenario? Because no user has `b-1-d` locale...
Bug 1581960 Comment 12 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
> Sorry, I don't understand the implications of filtering them out. Where is the filtering being done, what does that affect?
If you pass sth like this:
```js
let requested = ["pl"];
let available = ["en", "b-1-d", "b-e", "pl", "ru", "fr"];
let supported = negotiateLanguages(requested, available);
```
then we have to figure out what to do with `b-1-d` and `b-e`. They are not language identifiers and we won't allow user to ever select such string as a requested locale, so it'll never match.
What we do right now is filter them out, so that the real list of available passed to negotiation is `["en", "pl", "ru", "fr"]` in such a case.
I'd like to strengthen it, initially just issuing a warning if you try to pass invalid locales as available/default, to make it easier to catch when you pass something that is not a Unicode Language Identifier there, rather than just quietly filter them out.
My question is, why is `b-1-d` passed to available locales? It's not a locale. What is it meant to match against? In which scenario? Because no user has `b-1-d` locale...