Localised response for discovery api is inconsistent (original) (raw)

If you make straight /api/v4/discovery/ request in the results you get all the localised addon.name the developer has provided, as a dict, but heading and description are only sent in en-US. We don't indicate that the heading and description response may be localised in the API docs.

If you request a particular lang, /api/v4/discovery/?lang=fr you sometimes get addon.name in the locale requested, if the developer has provided it, and sometimes get heading and description in the locale requested, if the localisation community has localised the string already.

We also use addon.name in the heading. With an addon that has name = {'en-US': `foo`, 'fr': 'lé foo'} and default_locale = 'fr' if you make a request such as /api/v4/discovery/?lang=de and heading has only been localised into fr so far, the response would be <en-US text><fr name><en-US text>, even though we could output a complete response in fr or in en-US. And we don't indicate to the client that this mixed response isn't actually de.