Closed pbock closed 4 months ago
We should be specific / deliberate about the default language that is returned with *. Right now Russian is the first in the list and so it will be picked. We should update this to use the defined 'default' language. Currently it looks like flask is not doing this.
At a first glance: in
https://github.com/alephdata/aleph/blob/35f99ce768587c8d8c65ecd4288221f8f2ba38ef/aleph/core.py#L49
we are using werkzeug's AcceptLanguage.best_match which specifically matches *
against any item. The list of UI languages we are checking against happens to have ru
as the first entry:
I'm guessing that if the accept-header says *
we should return the default language: https://github.com/alephdata/aleph/blob/35f99ce768587c8d8c65ecd4288221f8f2ba38ef/aleph/settings.py#L125
Describe the bug When making an HTTP request to the Aleph API with the Accept-Language header set to
*
(as seems to be the default in the node.js implementation offetch()
), any error messages will be in Russian.To Reproduce Assuming Aleph is running on port 8080:
Expected behavior Requests with
Accept-Language: *
should be treated as if the header was not set at all.(You could argue that the semantics of
*
are “Any language will do” while a missing header indicates “Give me the default”, but since this is caused by the default behaviour of node.js’s standard library, I imagine I won’t be the only one who is going to find themselves unexpectedly told off in Russian.)Aleph version 3.15.5