The addons-frontend app makes API requests with a language setting in hopes that we receive localized responses.
As discovered via https://github.com/mozilla/addons-server/issues/4652, some error messages such as this one are not marked for localization.
Example request:
POST http://olympia.dev/api/v3/addons/addon/sound-control/reviews/?lang=de
This could result in:
{"non_field_errors":["An add-on author can not leave a review on its own add-on."]}
Can we get these strings localized? It should be possible with a lazy gettext call.
Here is my rationale for why I think the API should be responsible for localizing error messages: https://github.com/mozilla/addons-frontend/issues/1775#issuecomment-278817291
Part of the reason why I didn't do it is that I made up the error messages myself (sometimes writing APIs that we didn't need yet) and I'm not a native english speaker. If we can agree on the wording then yes, it's trivial to localize the messages.
Can anyone confirm those strings in the ratings API are good, and if not, suggest better ones ?
Slight tweaks:
(The second one I was a bit unclear on but I think that's what it means.)
The second one should not be exposed to the user through the frontend, but yes, you got it.
Do you think we should conjugate the first 3 ? Like, "You can't reply to a review...".
Do you think we should conjugate the first 3 ? Like, "You can't reply to a review...".
Yes, actually! Good call. The third one should change a bit for that: "You can't review this version of this add-on; it doesn't exist or isn't public."
Yeah, I agree on the conjugation. All messages should be complete sentences.
I wouldn't worry too much about getting them perfect, we can make tweaks to them as people (like QA, etc) review the site. I know that it's a little more work for localizers that way but I think they are already aware that we are actively developing a new version of the site.
Would it also help to mark all unlocalized strings with _to_localize('The yet to be localized text')? (Or some no-op function like that.) We did that before so we could easily grep to find all strings.
Might as well localize the strings directly :) I'll submit a PR shortly for the strings I've found.