I’ve been trying to figure out how i18n on /api/2/metadata
works; if I set my language to German in the user settings, then it first returns English in the metadata, and then it does exactly the same request again with every header etc. exactly the same, and now it returns German (locale
is de
instead of en
, strings are translated).
I’ve been reading through the code for a bit now, but I have no idea how this works, or even how it could possibly work. I assume it has some internal state somewhere, but how does it know to send back English again when I press F5 and do a hard reset? First I thought it must be the X-Aleph-Session
, but that’s the same after a refresh as well.
(It needs to do both those requests; if it always returns English or always returns German then the frontend breaks).
(Tested with 3.17.0 locally and 4.0.0-rc57 on https://aleph.occrp.org – both behave identical).