mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
123 stars 53 forks source link

Existing locales section is not updated when making changes in other locales for a custom license #1886

Open ioanarusiczki opened 2 years ago

ioanarusiczki commented 2 years ago

STR: Making PATCH requests with https://addons-dev.allizom.org/api/v5/addons/addon/621499/versions/1693994/ such as: {"custom_license": {"name": {"en-US": "en-US","ro":"ceva","fr":"french"},"text":{"en-US":"en-US", "ro":"ro", "fr":"fr"}}}

I've noticed that on Manage Authors&License page the Existing Locales from Localize for dropdown is not updated.

Expected result: there should be 2 existing locales: ro, fr

Actual result: no locales

no locales

Notes: I verified all possible pages with localized fields -> only the custom licenses seem to be affected. It is also reproducible on AMO stage. The frontend displays them correctly.

┆Issue is synchronized with this Jira Task

eviljeff commented 2 years ago

yeah... devhub's support for localization for licenses is patchy because it's a separate model to Addon (and Version) where the default_locale is defined. I'm surprised it's not working however. (I wonder if there localisations in the add-on fields - e.g. name, summary, etc - they would show up here too?)

diox commented 2 years ago

The Existing Locales section is built in JavaScript, from https://github.com/mozilla/addons-server/blob/1e0ed88eb4fd22ed24d7d3ee56fa25ed226b64db/static/js/zamboni/l10n.js#L42, which looks at all .trans [lang] elements to find out what locales are used on the page.

The License name and text are a bit weird. They do not appear to be translatable at all, at least not in the usual way. In the form, they are not TransFields, but rather regular fields with a translation widget. I'm not sure why, maybe because of the default_locale issue @eviljeff pointed out in the comment above, maybe because it's a dynamic thing that only appears for custom licenses, but that's the reason the existing locales section is not populated correctly.

ioanarusiczki commented 2 years ago

@diox @eviljeff as discussed, I removed the prod label.

KevinMind commented 2 months ago

Old Jira Ticket: https://mozilla-hub.atlassian.net/browse/ADDSRV-102